├── .gitignore ├── CrashLib-iOS ├── CrashLib-iOS-Info.plist ├── CrashLib-iOS-Prefix.pch └── en.lproj │ └── InfoPlist.strings ├── CrashLib ├── CrashLib-Info.plist ├── CrashLib-Prefix.pch ├── CrashLib.h └── en.lproj │ └── InfoPlist.strings ├── CrashProbe iOS ├── 114x114.png ├── 120x120.png ├── 144x144.png ├── 29x29.png ├── 57x57.png ├── 58x58.png ├── 72x72.png ├── 80x80.png ├── CRLAppDelegate.h ├── CRLAppDelegate.m ├── CRLDetailViewController.h ├── CRLDetailViewController.m ├── CRLFakeCXXClass.h ├── CRLFakeCXXClass.mm ├── CRLMasterViewController.h ├── CRLMasterViewController.m ├── CrashProbe iOS-Info.plist ├── CrashProbe iOS-Prefix.pch ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── crashButton-disabled.png ├── crashButton-disabled@2x.png ├── crashButton-highlighted.png ├── crashButton-highlighted@2x.png ├── crashButton-normal.png ├── crashButton-normal@2x.png ├── en.lproj │ ├── InfoPlist.strings │ └── MainStoryboard.storyboard └── main.m ├── CrashProbe.iconset ├── icon_128x128.png ├── icon_128x128@2x.png ├── icon_16x16.png ├── icon_16x16@2x.png ├── icon_256x256.png ├── icon_256x256@2x.png ├── icon_32x32.png ├── icon_32x32@2x.png ├── icon_512x512.png └── icon_512x512@2x.png ├── CrashProbe.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── CrashLib.xcscheme │ ├── CrashLibiOS.xcscheme │ ├── CrashProbe.xcscheme │ └── CrashProbeiOS.xcscheme ├── CrashProbe ├── CRLAppDelegate.h ├── CRLAppDelegate.m ├── CRLCrash.h ├── CRLCrash.m ├── CRLCrashAbort.h ├── CRLCrashAbort.m ├── CRLCrashAsyncSafeThread.h ├── CRLCrashAsyncSafeThread.m ├── CRLCrashCXXException.h ├── CRLCrashCXXException.mm ├── CRLCrashCorruptMalloc.h ├── CRLCrashCorruptMalloc.m ├── CRLCrashCorruptObjC.h ├── CRLCrashCorruptObjC.m ├── CRLCrashGarbage.h ├── CRLCrashGarbage.m ├── CRLCrashListViewController.h ├── CRLCrashListViewController.m ├── CRLCrashNSLog.h ├── CRLCrashNSLog.m ├── CRLCrashNULL.h ├── CRLCrashNULL.m ├── CRLCrashNXPage.h ├── CRLCrashNXPage.m ├── CRLCrashObjCException.h ├── CRLCrashObjCException.m ├── CRLCrashObjCMsgSend.h ├── CRLCrashObjCMsgSend.m ├── CRLCrashOverwriteLinkRegister.h ├── CRLCrashOverwriteLinkRegister.m ├── CRLCrashPrivInst.h ├── CRLCrashPrivInst.m ├── CRLCrashROPage.h ├── CRLCrashROPage.m ├── CRLCrashReleasedObject.h ├── CRLCrashReleasedObject.m ├── CRLCrashSmashStackBottom.h ├── CRLCrashSmashStackBottom.m ├── CRLCrashSmashStackTop.h ├── CRLCrashSmashStackTop.m ├── CRLCrashStackGuard.h ├── CRLCrashStackGuard.m ├── CRLCrashSwift.swift ├── CRLCrashTrap.h ├── CRLCrashTrap.m ├── CRLCrashUndefInst.h ├── CRLCrashUndefInst.m ├── CRLFramelessDWARF.h ├── CRLFramelessDWARF.m ├── CRLFramelessDWARF_arm32.S ├── CRLFramelessDWARF_arm64.s ├── CRLFramelessDWARF_i386.s ├── CRLFramelessDWARF_x86_64.s ├── CRLMainWindow.xib ├── CRLMainWindowController.h ├── CRLMainWindowController.m ├── CrashLib-Bridging-Header.h ├── CrashProbe-Info.plist ├── CrashProbe-Prefix.pch ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.xib └── main.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | DerivedData/ 2 | xcuserdata/ 3 | .DS_Store 4 | 5 | -------------------------------------------------------------------------------- /CrashLib-iOS/CrashLib-iOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /CrashLib-iOS/CrashLib-iOS-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CrashLib-iOS' target in the 'CrashLib-iOS' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /CrashLib-iOS/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CrashLib/CrashLib-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSHumanReadableCopyright 26 | Copyright © 2013 Bit Stadium GmbH. All rights reserved. 27 | NSPrincipalClass 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /CrashLib/CrashLib-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CrashLib' target in the 'CrashLib' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /CrashLib/CrashLib.h: -------------------------------------------------------------------------------- 1 | // 2 | // CrashLib.h 3 | // CrashLib 4 | // 5 | // Created by Gwynne Raskind on 4/5/13. 6 | // Copyright (c) 2013 Bit Stadium GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | -------------------------------------------------------------------------------- /CrashLib/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CrashProbe iOS/114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/114x114.png -------------------------------------------------------------------------------- /CrashProbe iOS/120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/120x120.png -------------------------------------------------------------------------------- /CrashProbe iOS/144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/144x144.png -------------------------------------------------------------------------------- /CrashProbe iOS/29x29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/29x29.png -------------------------------------------------------------------------------- /CrashProbe iOS/57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/57x57.png -------------------------------------------------------------------------------- /CrashProbe iOS/58x58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/58x58.png -------------------------------------------------------------------------------- /CrashProbe iOS/72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/72x72.png -------------------------------------------------------------------------------- /CrashProbe iOS/80x80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/80x80.png -------------------------------------------------------------------------------- /CrashProbe iOS/CRLAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | 29 | @interface CRLAppDelegate : UIResponder 30 | 31 | @property (strong, nonatomic) UIWindow *window; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CrashProbe iOS/CRLAppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLAppDelegate.h" 28 | 29 | @implementation CRLAppDelegate 30 | 31 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 32 | { 33 | return YES; 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /CrashProbe iOS/CRLDetailViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | #import 29 | 30 | @interface CRLDetailViewController : UIViewController 31 | 32 | @property(strong,nonatomic) CRLCrash *detailItem; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /CrashProbe iOS/CRLDetailViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLDetailViewController.h" 28 | 29 | @interface CRLDetailViewController () 30 | 31 | @property(strong,nonatomic) IBOutlet UILabel *titleLabel; 32 | @property(strong,nonatomic) IBOutlet UILabel *descriptionLabel; 33 | @property(strong,nonatomic) IBOutlet UIImageView *descriptionImage; 34 | 35 | - (IBAction)doCrash; 36 | 37 | @end 38 | 39 | @implementation CRLDetailViewController 40 | 41 | - (void)viewWillAppear:(BOOL)animated 42 | { 43 | [super viewWillAppear:animated]; 44 | 45 | self.titleLabel.text = self.detailItem.title; 46 | self.descriptionLabel.text = self.detailItem.desc; 47 | // self.descriptionImage.image = nil; 48 | self.navigationItem.title = @"Crash"; 49 | } 50 | 51 | - (IBAction)doCrash 52 | { 53 | [self.detailItem crash]; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /CrashProbe iOS/CRLFakeCXXClass.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | 29 | /* 30 | This header is purposely empty. Due to a bug in Xcode, a project which links 31 | to a shared or static library which contains C++ or Objective-C++ code but 32 | contains no such of its own will attempt to link without the necessary C++ 33 | libraries. The presence of an empty .mm file is sufficient to cause Xcode to 34 | build with clang++ instead of clang, avoiding the issue. 35 | */ 36 | -------------------------------------------------------------------------------- /CrashProbe iOS/CRLFakeCXXClass.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLFakeCXXClass.h" 28 | 29 | /* 30 | This file is purposely empty. Due to a bug in Xcode, a project which links 31 | to a shared or static library which contains C++ or Objective-C++ code but 32 | contains no such of its own will attempt to link without the necessary C++ 33 | libraries. The presence of an empty .mm file is sufficient to cause Xcode to 34 | build with clang++ instead of clang, avoiding the issue. 35 | */ 36 | -------------------------------------------------------------------------------- /CrashProbe iOS/CRLMasterViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | 29 | @interface CRLMasterViewController : UITableViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe iOS/CRLMasterViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLMasterViewController.h" 28 | #import "CRLDetailViewController.h" 29 | #import 30 | #import 31 | 32 | @interface CRLMasterViewController () 33 | 34 | @property(nonatomic,strong) NSDictionary *knownCrashes; 35 | 36 | @end 37 | 38 | @implementation CRLMasterViewController 39 | 40 | - (void)viewDidLoad 41 | { 42 | [super viewDidLoad]; 43 | 44 | [self pokeAllCrashes]; 45 | 46 | NSMutableArray *crashes = [NSMutableArray arrayWithArray:[CRLCrash allCrashes]]; 47 | [crashes sortUsingComparator:^NSComparisonResult(CRLCrash *obj1, CRLCrash *obj2) { 48 | if ([obj1.category isEqualToString:obj2.category]) { 49 | return [obj1.title compare:obj2.title]; 50 | } else { 51 | return [obj1.category compare:obj2.category]; 52 | } 53 | }]; 54 | 55 | NSMutableDictionary *categories = @{}.mutableCopy; 56 | 57 | for (CRLCrash *crash in crashes) 58 | categories[crash.category] = [(categories[crash.category] ?: @[]) arrayByAddingObject:crash]; 59 | 60 | self.knownCrashes = categories.copy; 61 | 62 | } 63 | 64 | - (void)pokeAllCrashes 65 | { 66 | unsigned int nclasses = 0; 67 | Class *classes = objc_copyClassList(&nclasses); 68 | 69 | for (unsigned int i = 0; i < nclasses; ++i) { 70 | if (classes[i] && 71 | class_getSuperclass(classes[i]) == [CRLCrash class] && 72 | class_respondsToSelector(classes[i], @selector(methodSignatureForSelector:)) && 73 | classes[i] != [CRLCrash class]) 74 | { 75 | [CRLCrash registerCrash:[[classes[i] alloc] init]]; 76 | } 77 | } 78 | free(classes); 79 | } 80 | 81 | - (NSArray *)sortedAllKeys { 82 | NSMutableArray *result = [NSMutableArray arrayWithArray:self.knownCrashes.allKeys]; 83 | 84 | [result sortUsingComparator:^NSComparisonResult(NSString *obj1, NSString *obj2) { 85 | return [obj1 compare:obj2]; 86 | }]; 87 | 88 | return [result copy]; 89 | } 90 | 91 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 92 | { 93 | return (NSInteger)self.knownCrashes.count; 94 | } 95 | 96 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 97 | { 98 | return self.sortedAllKeys[(NSUInteger)section]; 99 | } 100 | 101 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 102 | { 103 | return (NSInteger)((NSArray *)self.knownCrashes[self.sortedAllKeys[(NSUInteger)section]]).count; 104 | } 105 | 106 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 107 | { 108 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"crash" forIndexPath:indexPath]; 109 | CRLCrash *crash = (CRLCrash *)(((NSArray *)self.knownCrashes[self.sortedAllKeys[(NSUInteger)indexPath.section]])[(NSUInteger)indexPath.row]); 110 | 111 | cell.textLabel.text = crash.title; 112 | return cell; 113 | } 114 | 115 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 116 | { 117 | if ([[segue identifier] isEqualToString:@"showDetail"]) { 118 | NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 119 | CRLCrash *crash = (CRLCrash *)(((NSArray *)self.knownCrashes[self.sortedAllKeys[(NSUInteger)indexPath.section]])[(NSUInteger)indexPath.row]); 120 | 121 | ((CRLDetailViewController *)segue.destinationViewController).detailItem = crash; 122 | } 123 | } 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /CrashProbe iOS/CrashProbe iOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | CrashProbe 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIcons 12 | 13 | CFBundlePrimaryIcon 14 | 15 | CFBundleIconFiles 16 | 17 | 80x80 18 | 120x120 19 | 114x114 20 | 58x58 21 | 29x29 22 | 57x57 23 | CrashProbe 24 | 25 | UIPrerenderedIcon 26 | 27 | 28 | UINewsstandIcon 29 | 30 | CFBundleIconFiles 31 | 32 | 33 | 34 | UINewsstandBindingEdge 35 | UINewsstandBindingEdgeLeft 36 | UINewsstandBindingType 37 | UINewsstandBindingTypeMagazine 38 | 39 | 40 | CFBundleIdentifier 41 | $(PRODUCT_BUNDLE_IDENTIFIER) 42 | CFBundleInfoDictionaryVersion 43 | 6.0 44 | CFBundleName 45 | ${PRODUCT_NAME} 46 | CFBundlePackageType 47 | APPL 48 | CFBundleShortVersionString 49 | 1.0 50 | CFBundleSignature 51 | ???? 52 | CFBundleVersion 53 | 1 54 | LSRequiresIPhoneOS 55 | 56 | UILaunchStoryboardName 57 | MainStoryboard 58 | UIMainStoryboardFile 59 | MainStoryboard 60 | UIRequiredDeviceCapabilities 61 | 62 | armv7 63 | 64 | UIStatusBarTintParameters 65 | 66 | UINavigationBar 67 | 68 | Style 69 | UIBarStyleDefault 70 | Translucent 71 | 72 | 73 | 74 | UISupportedInterfaceOrientations 75 | 76 | UIInterfaceOrientationPortrait 77 | UIInterfaceOrientationPortraitUpsideDown 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /CrashProbe iOS/CrashProbe iOS-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'CrashProbe iOS' target in the 'CrashProbe iOS' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /CrashProbe iOS/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/Default-568h@2x.png -------------------------------------------------------------------------------- /CrashProbe iOS/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/Default.png -------------------------------------------------------------------------------- /CrashProbe iOS/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/Default@2x.png -------------------------------------------------------------------------------- /CrashProbe iOS/crashButton-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/crashButton-disabled.png -------------------------------------------------------------------------------- /CrashProbe iOS/crashButton-disabled@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/crashButton-disabled@2x.png -------------------------------------------------------------------------------- /CrashProbe iOS/crashButton-highlighted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/crashButton-highlighted.png -------------------------------------------------------------------------------- /CrashProbe iOS/crashButton-highlighted@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/crashButton-highlighted@2x.png -------------------------------------------------------------------------------- /CrashProbe iOS/crashButton-normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/crashButton-normal.png -------------------------------------------------------------------------------- /CrashProbe iOS/crashButton-normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe iOS/crashButton-normal@2x.png -------------------------------------------------------------------------------- /CrashProbe iOS/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CrashProbe iOS/en.lproj/MainStoryboard.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 85 | 93 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /CrashProbe iOS/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CrashProbe iOS 4 | // 5 | // Created by Gwynne Raskind on 3/18/13. 6 | // Copyright (c) 2013 Bit Stadium GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CRLAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CRLAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_128x128.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_16x16.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_256x256.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_32x32.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_512x512.png -------------------------------------------------------------------------------- /CrashProbe.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitstadium/CrashProbe/3c4f796496bb140c87cae8c31bf60c68a7ec4297/CrashProbe.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /CrashProbe.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CrashProbe.xcodeproj/xcshareddata/xcschemes/CrashLib.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /CrashProbe.xcodeproj/xcshareddata/xcschemes/CrashLibiOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /CrashProbe.xcodeproj/xcshareddata/xcschemes/CrashProbe.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /CrashProbe.xcodeproj/xcshareddata/xcschemes/CrashProbeiOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /CrashProbe/CRLAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | 29 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 30 | @class CRLMainWindowController; 31 | #endif 32 | 33 | @interface CRLAppDelegate : NSObject 34 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 35 | { 36 | NSWindow *_window; 37 | CRLMainWindowController *_windowController; 38 | } 39 | #endif 40 | 41 | @property(nonatomic,strong) IBOutlet NSWindow *window; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /CrashProbe/CRLAppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLAppDelegate.h" 28 | #import "CRLMainWindowController.h" 29 | 30 | @interface CRLAppDelegate () 31 | 32 | @property(nonatomic,strong) CRLMainWindowController *windowController; 33 | 34 | @end 35 | 36 | @implementation CRLAppDelegate 37 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 38 | @synthesize window = _window, windowController = _windowController; 39 | #endif 40 | 41 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 42 | { 43 | self.windowController = [[CRLMainWindowController alloc] init]; 44 | [(self.window = self.windowController.window) makeKeyAndOrderFront:self]; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | 29 | @interface CRLCrash : NSObject 30 | 31 | + (NSArray *)allCrashes; 32 | + (void)registerCrash:(CRLCrash *)crash; 33 | + (void)unregisterCrash:(CRLCrash *)crash; 34 | 35 | @property(nonatomic,copy,readonly) NSString *category; 36 | @property(nonatomic,copy,readonly) NSString *title; 37 | @property(nonatomic,copy,readonly) NSString *desc; 38 | 39 | - (void)crash; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrash.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | static NSMutableSet *crashTypes = nil; 30 | 31 | @implementation CRLCrash 32 | 33 | + (void)initialize 34 | { 35 | static dispatch_once_t predicate = 0; 36 | 37 | dispatch_once(&predicate, ^ { crashTypes = [[NSMutableSet alloc] init]; }); 38 | } 39 | 40 | + (NSArray *)allCrashes 41 | { 42 | return crashTypes.allObjects; 43 | } 44 | 45 | + (void)registerCrash:(CRLCrash *)crash 46 | { 47 | [crashTypes addObject:crash]; 48 | } 49 | 50 | + (void)unregisterCrash:(CRLCrash *)crash 51 | { 52 | [crashTypes removeObject:crash]; 53 | } 54 | 55 | - (NSString *)category 56 | { 57 | return @"NONE"; 58 | } 59 | 60 | - (NSString *)title 61 | { 62 | return @"NONE"; 63 | } 64 | 65 | - (NSString *)desc 66 | { 67 | return @"NONE"; 68 | } 69 | 70 | - (void)crash 71 | { 72 | NSLog(@"I'm supposed to crash here."); 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashAbort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashAbort : CRLCrash 30 | 31 | - (void)crash __attribute__((noreturn)); 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashAbort.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashAbort.h" 28 | 29 | @implementation CRLCrashAbort 30 | 31 | - (NSString *)category { return @"SIGTRAP"; } 32 | - (NSString *)title { return @"Call abort()"; } 33 | - (NSString *)desc { return @"Call abort() to terminate the program."; } 34 | 35 | - (void)crash __attribute__((noreturn)) 36 | { 37 | abort(); 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashAsyncSafeThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashAsyncSafeThread : CRLCrash 30 | 31 | @end -------------------------------------------------------------------------------- /CrashProbe/CRLCrashAsyncSafeThread.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashAsyncSafeThread.h" 28 | #import 29 | 30 | @implementation CRLCrashAsyncSafeThread 31 | 32 | - (NSString *)category { return @"Async-Safety"; } 33 | - (NSString *)title { return @"Crash with _pthread_list_lock held"; } 34 | - (NSString *)desc { return @"" 35 | "Triggers a crash with libsystem_pthread's _pthread_list_lock held, " 36 | "causing non-async-safe crash reporters that use pthread APIs to deadlock."; 37 | } 38 | 39 | - (void)crash 40 | { 41 | pthread_getname_np(pthread_self(), ((char *) 0x1), 1); 42 | 43 | /* This is unreachable, but prevents clang from applying TCO to the above when 44 | * optimization is enabled. */ 45 | NSLog(@"I'm here from the tail call prevention department."); 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashCXXException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashCXXException : CRLCrash 30 | 31 | - (void)crash __attribute__((noreturn)); 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashCXXException.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashCXXException.h" 28 | #import 29 | 30 | class kaboom_exception : public std::exception 31 | { 32 | virtual const char* what() const throw(); 33 | }; 34 | 35 | const char* kaboom_exception::what() const throw() 36 | { 37 | return "If this had been a real exception, you would be cursing now."; 38 | } 39 | 40 | @implementation CRLCrashCXXException 41 | 42 | - (NSString *)category { return @"Exceptions"; } 43 | - (NSString *)title { return @"Throw C++ exception"; } 44 | - (NSString *)desc { return @"" 45 | "Throw an uncaught C++ exception. " 46 | "This is a difficult case for crash reporters to handle, " 47 | "as it involves the destruction of the data necessary to generate a correct backtrace."; 48 | } 49 | 50 | - (void)crash __attribute__((noreturn)) 51 | { 52 | throw new kaboom_exception; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashCorruptMalloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashCorruptMalloc : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashCorruptMalloc.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashCorruptMalloc.h" 28 | #import 29 | #import 30 | 31 | @implementation CRLCrashCorruptMalloc 32 | 33 | - (NSString *)category { return @"Various"; } 34 | - (NSString *)title { return @"Corrupt malloc()'s internal tracking information"; } 35 | - (NSString *)desc { return @"" 36 | "Write garbage into data areas used by malloc to track memory allocations. " 37 | "This simulates the kind of heap overflow and/or heap corruption likely to occur in an application; " 38 | "if the crash reporter itself uses malloc, the corrupted heap will likely trigger a crash in the crash reporter itself."; 39 | } 40 | 41 | - (void)crash { 42 | /* Smash the heap, and keep smashing it until we eventually hit something non-writable, or trigger 43 | * a malloc error (e.g., in NSLog). */ 44 | uint8_t *memory = malloc(10); 45 | while (true) { 46 | NSLog(@"Smashing [%p - %p]", memory, memory + PAGE_SIZE); 47 | memset((void *) trunc_page((vm_address_t)memory), 0xAB, PAGE_SIZE); 48 | memory += PAGE_SIZE; 49 | } 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashCorruptObjC.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashCorruptObjC : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashCorruptObjC.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashCorruptObjC.h" 28 | #import 29 | #import 30 | #import 31 | #import 32 | 33 | @implementation CRLCrashCorruptObjC 34 | 35 | - (NSString *)category { return @"Various"; } 36 | - (NSString *)title { return @"Corrupt the Objective-C runtime's structures"; } 37 | - (NSString *)desc { return @"" 38 | "Write garbage into data areas used by the Objective-C runtime to track classes and objects. " 39 | "Bugs of this nature are why crash reporters cannot use Objective-C in their crash handling code, " 40 | "as attempting to do so is likely to lead to a crash in the crash reporting code."; 41 | } 42 | 43 | - (void)crash 44 | { 45 | Class objClass = [NSObject class]; 46 | 47 | // VERY VERY PRIVATE INTERNAL RUNTIME DETAILS VERY VERY EVIL THIS IS BAD!!! 48 | struct objc_cache_t { 49 | uintptr_t mask; /* total = mask + 1 */ 50 | uintptr_t occupied; 51 | void *buckets[1]; 52 | }; 53 | struct objc_class_t { 54 | struct objc_class_t *isa; 55 | struct objc_class_t *superclass; 56 | struct objc_cache_t cache; 57 | IMP *vtable; 58 | uintptr_t data_NEVER_USE; // class_rw_t * plus custom rr/alloc flags 59 | }; 60 | 61 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 62 | #define __bridge 63 | #endif 64 | 65 | struct objc_class_t *objClassInternal = (__bridge struct objc_class_t *)objClass; 66 | 67 | // Trashes NSObject's method cache 68 | memset(&objClassInternal->cache, 0xa5, sizeof(struct objc_cache_t)); 69 | 70 | [self description]; 71 | } 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashGarbage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashGarbage : CRLCrash 30 | @end 31 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashGarbage.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashGarbage.h" 28 | #import 29 | 30 | @implementation CRLCrashGarbage 31 | 32 | - (NSString *)category { return @"SIGSEGV"; } 33 | - (NSString *)title { return @"Dereference a bad pointer"; } 34 | - (NSString *)desc { return @"Attempt to read from a garbage pointer that's not mapped but also isn't NULL."; } 35 | 36 | - (void)crash 37 | { 38 | void *ptr = mmap(NULL, (size_t)getpagesize(), PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); 39 | 40 | if (ptr != MAP_FAILED) 41 | munmap(ptr, (size_t)getpagesize()); 42 | 43 | #if __i386__ 44 | asm volatile ( "mov %0, %%eax\n\tmov (%%eax), %%eax" : : "X" (ptr) : "memory", "eax" ); 45 | #elif __x86_64__ 46 | asm volatile ( "mov %0, %%rax\n\tmov (%%rax), %%rax" : : "X" (ptr) : "memory", "rax" ); 47 | #elif __arm__ && __ARM_ARCH == 7 48 | asm volatile ( "mov r4, %0\n\tldr r4, [r4]" : : "X" (ptr) : "memory", "r4" ); 49 | #elif __arm__ && __ARM_ARCH == 6 50 | asm volatile ( "mov r4, %0\n\tldr r4, [r4]" : : "X" (ptr) : "memory", "r4" ); 51 | #elif __arm64__ 52 | asm volatile ( "mov x4, %0\n\tldr x4, [x4]" : : "X" (ptr) : "memory", "x4" ); 53 | #endif 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashListViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | 29 | @class CRLCrash; 30 | @protocol CRLCrashListViewControllerDelegate; 31 | 32 | @interface CRLCrashListViewController : NSViewController 33 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 34 | { 35 | NSOutlineView *_outlineView; 36 | NSDictionary *_knownCrashes; 37 | id _delegate; 38 | } 39 | #define weak assign 40 | #endif 41 | 42 | - (instancetype)initWithOutlineView:(NSOutlineView *)view; 43 | 44 | @property(nonatomic,readonly) CRLCrash *selectedCrash; 45 | @property(nonatomic,weak) id delegate; 46 | 47 | @end 48 | 49 | @protocol CRLCrashListViewControllerDelegate 50 | 51 | - (void)controller:(CRLCrashListViewController *)controller didSelectCrash:(CRLCrash *)crash; 52 | 53 | @end -------------------------------------------------------------------------------- /CrashProbe/CRLCrashListViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashListViewController.h" 28 | #import 29 | #import 30 | 31 | @interface CRLCrashListViewController () 32 | 33 | @property(nonatomic,readonly) NSOutlineView *outlineView; 34 | @property(nonatomic,strong) NSDictionary *knownCrashes; 35 | 36 | @end 37 | 38 | @implementation CRLCrashListViewController 39 | 40 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 41 | @synthesize knownCrashes = _knownCrashes, outlineView = _outlineView, delegate = _delegate; 42 | #endif 43 | 44 | - (id)initWithOutlineView:(NSOutlineView *)view 45 | { 46 | if ((self = [super initWithNibName:nil bundle:nil])) 47 | { 48 | [self pokeAllCrashes]; 49 | 50 | NSMutableArray *crashes = [NSMutableArray arrayWithArray:[CRLCrash allCrashes]]; 51 | [crashes sortUsingComparator:^NSComparisonResult(CRLCrash *obj1, CRLCrash *obj2) { 52 | if ([obj1.category isEqualToString:obj2.category]) { 53 | return [obj1.title compare:obj2.title]; 54 | } else { 55 | return [obj1.category compare:obj2.category]; 56 | } 57 | }]; 58 | NSMutableDictionary *categories = @{}.mutableCopy; 59 | 60 | for (CRLCrash *crash in crashes) 61 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 62 | [categories setObject:[([categories objectForKey:crash.category] ?: @[]) arrayByAddingObject:crash] forKey:crash.category]; 63 | #else 64 | categories[crash.category] = [(categories[crash.category] ?: @[]) arrayByAddingObject:crash]; 65 | #endif 66 | 67 | self.knownCrashes = categories.copy; 68 | 69 | self.view = view; 70 | self.outlineView.dataSource = self; 71 | self.outlineView.delegate = self; 72 | } 73 | return self; 74 | } 75 | 76 | - (void)pokeAllCrashes 77 | { 78 | unsigned int nclasses = 0; 79 | Class *classes = objc_copyClassList(&nclasses); 80 | 81 | for (unsigned int i = 0; i < nclasses; ++i) { 82 | if (classes[i] && 83 | class_getSuperclass(classes[i]) == [CRLCrash class] && 84 | class_respondsToSelector(classes[i], @selector(methodSignatureForSelector:)) && 85 | classes[i] != [CRLCrash class]) 86 | { 87 | [CRLCrash registerCrash:[[classes[i] alloc] init]]; 88 | } 89 | } 90 | free(classes); 91 | } 92 | 93 | - (NSArray *)sortedAllKeys { 94 | NSMutableArray *result = [NSMutableArray arrayWithArray:self.knownCrashes.allKeys]; 95 | 96 | [result sortUsingComparator:^NSComparisonResult(NSString *obj1, NSString *obj2) { 97 | return [obj1 compare:obj2]; 98 | }]; 99 | 100 | return [result copy]; 101 | } 102 | 103 | - (NSOutlineView *)outlineView 104 | { 105 | return (NSOutlineView *)self.view; 106 | } 107 | 108 | - (void)loadView 109 | { 110 | NSAssert([self.view isKindOfClass:[NSOutlineView class]], @"Is an outline view"); 111 | 112 | [self.outlineView expandItem:nil expandChildren:YES]; 113 | dispatch_after(DISPATCH_TIME_NOW, dispatch_get_main_queue(), ^ { 114 | [self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO]; 115 | }); 116 | } 117 | 118 | - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item 119 | { 120 | if (item == nil) 121 | return (NSInteger)self.knownCrashes.count; 122 | else if ([item isKindOfClass:[NSString class]]) 123 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 124 | return (NSInteger)((NSArray *)[self.knownCrashes objectForKey:item]).count; 125 | #else 126 | return (NSInteger)((NSArray *)self.knownCrashes[item]).count; 127 | #endif 128 | return 0; 129 | } 130 | 131 | - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item 132 | { 133 | if (item == nil) 134 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 135 | return [self.sortedAllKeys objectAtIndex:(NSUInteger)index]; 136 | #else 137 | return self.sortedAllKeys[(NSUInteger)index]; 138 | #endif 139 | else 140 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 141 | return [[self.knownCrashes objectForKey:item] objectAtIndex:(NSUInteger)index]; 142 | #else 143 | return self.knownCrashes[item][(NSUInteger)index]; 144 | #endif 145 | } 146 | 147 | - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item 148 | { 149 | return [item isKindOfClass:[NSString class]]; 150 | } 151 | 152 | - (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item 153 | { 154 | if ([item isKindOfClass:[NSString class]]) 155 | { 156 | NSTableCellView *view = [outlineView makeViewWithIdentifier:@"header" owner:self]; 157 | 158 | view.textField.stringValue = item; 159 | // view.textField.textColor = [NSColor redColor]; 160 | return view; 161 | } 162 | else if ([item isKindOfClass:[CRLCrash class]]) 163 | { 164 | NSTableCellView *view = [outlineView makeViewWithIdentifier:@"crash" owner:self]; 165 | 166 | view.textField.stringValue = ((CRLCrash *)item).title; 167 | view.textField.textColor = [NSColor blackColor]; 168 | return view; 169 | } 170 | return nil; 171 | } 172 | 173 | - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item 174 | { 175 | return [item isKindOfClass:[NSString class]]; 176 | } 177 | 178 | - (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item 179 | { 180 | return [item isKindOfClass:[CRLCrash class]]; 181 | } 182 | 183 | - (void)outlineViewSelectionDidChange:(NSNotification *)notification 184 | { 185 | typeof(self.delegate) s_delegate = self.delegate; 186 | 187 | [s_delegate controller:self didSelectCrash:[self.outlineView itemAtRow:self.outlineView.selectedRow]]; 188 | } 189 | 190 | - (CRLCrash *)selectedCrash 191 | { 192 | id selectedItem = [self.outlineView itemAtRow:self.outlineView.selectedRow]; 193 | 194 | return [selectedItem isKindOfClass:[CRLCrash class]] ? selectedItem : nil; 195 | } 196 | 197 | @end 198 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashNSLog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashNSLog : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashNSLog.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashNSLog.h" 28 | 29 | @implementation CRLCrashNSLog 30 | 31 | - (NSString *)category { return @"Objective-C"; } 32 | - (NSString *)title { return @"Access a non-object as an object"; } 33 | - (NSString *)desc { return @"Call NSLog(@\"%@\", 16);, causing a crash when the runtime attempts to treat 16 as a pointer to an object."; } 34 | 35 | - (void)crash 36 | { 37 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 38 | #define __bridge 39 | #endif 40 | 41 | NSLog(@"%@", (__bridge id)(void *)16); 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashNULL.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashNULL : CRLCrash 30 | @end 31 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashNULL.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | #import "CRLCrashNULL.h" 27 | 28 | @implementation CRLCrashNULL 29 | 30 | - (NSString *)category { return @"SIGSEGV"; } 31 | - (NSString *)title { return @"Dereference a NULL pointer"; } 32 | - (NSString *)desc { return @"Attempt to read from 0x0, which causes a segmentation violation."; } 33 | 34 | - (void)crash 35 | { 36 | volatile char *ptr = NULL; 37 | (void)*ptr; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashNXPage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashNXPage : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashNXPage.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashNXPage.h" 28 | #import 29 | 30 | @implementation CRLCrashNXPage 31 | 32 | - (NSString *)category { return @"SIGSEGV"; } 33 | - (NSString *)title { return @"Jump into an NX page"; } 34 | - (NSString *)desc { return @"Call a function pointer to memory in a non-executable page."; } 35 | 36 | static void __attribute__((noinline)) real_NXcrash(void) 37 | { 38 | void *ptr = mmap(NULL, (size_t)getpagesize(), PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); 39 | 40 | if (ptr != MAP_FAILED) { 41 | ((void (*)(void))ptr)(); 42 | } 43 | 44 | munmap(ptr, (size_t)getpagesize()); 45 | } 46 | 47 | - (void)crash 48 | { 49 | real_NXcrash(); 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashObjCException.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashObjCException : CRLCrash 30 | 31 | - (void)crash __attribute__((noreturn)); 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashObjCException.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashObjCException.h" 28 | 29 | @implementation CRLCrashObjCException 30 | 31 | - (NSString *)category { return @"Exceptions"; } 32 | - (NSString *)title { return @"Throw Objective-C exception"; } 33 | - (NSString *)desc { return @"" 34 | "Throw an uncaught Objective-C exception. " 35 | "It's possible to generate a better crash report here compared to the C++ Exception case " 36 | "because NSUncaughtExceptionHandler can be used, which isn't available for C++ extensions."; 37 | } 38 | 39 | - (void)crash __attribute__((noreturn)) 40 | { 41 | @throw [NSException exceptionWithName:NSGenericException reason:@"An uncaught exception! SCREAM." 42 | userInfo:@{ NSLocalizedDescriptionKey: @"I'm in your program, catching your exceptions!" }]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashObjCMsgSend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashObjCMsgSend : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashObjCMsgSend.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashObjCMsgSend.h" 28 | #import 29 | 30 | @implementation CRLCrashObjCMsgSend 31 | 32 | - (NSString *)category { return @"Objective-C"; } 33 | - (NSString *)title { return @"Crash inside objc_msgSend()"; } 34 | - (NSString *)desc { return @"Send a message to an invalid object, resulting in a crash inside objc_msgSend()."; } 35 | 36 | - (void)crash 37 | { 38 | struct { 39 | void *isa; 40 | } corruptObj = { 41 | .isa = (void *) 42 42 | }; 43 | 44 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 45 | #define __bridge 46 | #endif 47 | [(__bridge id)&corruptObj stringWithFormat: 48 | @"%u, %u, %u, %u, %u, %u, %f, %f, %c, %c, %s, %s, %@, %@" 49 | " %u, %u, %u, %u, %u, %u, %f, %f, %c, %c, %s, %s, %@, %@", 50 | 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 9.0, 10.0, 'a', 'b', "C", "D", @"E", @"F", 51 | 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 9.0, 10.0, 'a', 'b', "C", "D", @"E", @"F"]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashOverwriteLinkRegister.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashOverwriteLinkRegister : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashOverwriteLinkRegister.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashOverwriteLinkRegister.h" 28 | 29 | @implementation CRLCrashOverwriteLinkRegister 30 | 31 | - (NSString *)category { return @"Various"; } 32 | - (NSString *)title { return @"Overwrite link register, then crash"; } 33 | - (NSString *)desc { return @"" 34 | "Trigger a crash after first overwriting the link register. " 35 | "Crash reporters that insert a stack frame based on the link register can generate duplicate or incorrect stack frames in the report. " 36 | "This does not apply to architectures that do not use a link register, such as x86-64."; 37 | } 38 | 39 | - (void)crash { 40 | /* Call a method to trigger modification of LR. We use the result below to 41 | * convince the compiler to order this function the way we want it. */ 42 | uintptr_t ptr = (uintptr_t) [NSObject class]; 43 | 44 | /* Make-work code that simply advances the PC to better demonstrate the discrepency. We use the 45 | * 'ptr' value here to make sure the compiler doesn't optimize-away this code, or re-order it below 46 | * the method call. */ 47 | ptr += ptr; 48 | ptr -= 42; 49 | ptr += ptr % (ptr - 42); 50 | 51 | /* Crash within the method (using a write to the NULL page); the link register will be pointing at 52 | * the make-work code. We use the 'ptr' value to control compiler ordering. */ 53 | *((uintptr_t volatile *)NULL) = ptr; 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashPrivInst.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashPrivInst : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashPrivInst.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashPrivInst.h" 28 | 29 | @implementation CRLCrashPrivInst 30 | 31 | - (NSString *)category { return @"SIGILL"; } 32 | - (NSString *)title { return @"Execute a privileged instruction"; } 33 | - (NSString *)desc { return @"Attempt to execute an instruction that can only be executed in supervisor mode."; } 34 | 35 | - (void)crash 36 | { 37 | #if __i386__ 38 | asm volatile ( "hlt" : : : ); 39 | #elif __x86_64__ 40 | asm volatile ( "hlt" : : : ); 41 | #elif __arm__ && __ARM_ARCH == 7 && __thumb__ 42 | asm volatile ( ".long 0xf7f08000" : : : ); 43 | #elif __arm__ && __ARM_ARCH == 7 44 | asm volatile ( ".long 0xe1400070" : : : ); 45 | #elif __arm__ && __ARM_ARCH == 6 && __thumb__ 46 | asm volatile ( ".long 0xf5ff8f00" : : : ); 47 | #elif __arm__ && __ARM_ARCH == 6 48 | asm volatile ( ".long 0xe14ff000" : : : ); 49 | #elif __arm64__ 50 | /* Invalidate all EL1&0 regime stage 1 and 2 TLB entries. This should 51 | * not be possible from userspace, for hopefully obvious reasons :-) */ 52 | asm volatile ( "tlbi alle1" : : : ); 53 | #endif 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashROPage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashROPage : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashROPage.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashROPage.h" 28 | 29 | @implementation CRLCrashROPage 30 | 31 | static void __attribute__((used)) dummyfunc(void) 32 | { 33 | } 34 | 35 | - (NSString *)category { return @"SIGBUS"; } 36 | - (NSString *)title { return @"Write to a read-only page"; } 37 | - (NSString *)desc { return @"Attempt to write to a page into which the app's code is mapped."; } 38 | 39 | - (void)crash 40 | { 41 | volatile char *ptr = (char *)dummyfunc; 42 | *ptr = 0; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashReleasedObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashReleasedObject : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashReleasedObject.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashReleasedObject.h" 28 | #import 29 | 30 | @implementation CRLCrashReleasedObject 31 | 32 | - (NSString *)category { return @"Objective-C"; } 33 | - (NSString *)title { return @"Message a released object"; } 34 | - (NSString *)desc { return @"Send a message to an object whose memory has already been freed."; } 35 | 36 | - (void)crash 37 | { 38 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 39 | NSObject *object = [[NSObject alloc] init]; 40 | #else 41 | NSObject * __unsafe_unretained object = (__bridge NSObject *)CFBridgingRetain([[NSObject alloc] init]); 42 | #endif 43 | 44 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 45 | [object release]; 46 | #else 47 | CFRelease((__bridge CFTypeRef)object); 48 | #endif 49 | ^ __attribute__((noreturn)) { 50 | for (;;) { 51 | [object self]; 52 | [object description]; 53 | [object debugDescription]; 54 | } 55 | }(); 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashSmashStackBottom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashSmashStackBottom : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashSmashStackBottom.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashSmashStackBottom.h" 28 | 29 | @implementation CRLCrashSmashStackBottom 30 | 31 | - (NSString *)category { return @"Various"; } 32 | - (NSString *)title { return @"Smash the bottom of the stack"; } 33 | - (NSString *)desc { return @"" 34 | "Overwrite data below the current stack pointer. This will destroy the current function. " 35 | "Reporting of this crash is expected to fail. Succeeding is basically luck."; 36 | } 37 | 38 | - (void)crash 39 | { 40 | void *sp = NULL; 41 | 42 | #if __i386__ 43 | asm volatile ( "mov %%esp, %0" : "=X" (sp) : : ); 44 | #elif __x86_64__ 45 | asm volatile ( "mov %%rsp, %0" : "=X" (sp) : : ); 46 | #elif __arm__ && __ARM_ARCH == 7 47 | asm volatile ( "mov %0, sp" : "=X" (sp) : : ); 48 | #elif __arm__ && __ARM_ARCH == 6 49 | asm volatile ( "mov %0, sp" : "=X" (sp) : : ); 50 | #elif __arm64__ 51 | asm volatile ( "mov %0, sp" : "=X" (sp) : : ); 52 | #endif 53 | 54 | memset(sp, 0xa5, 0x100); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashSmashStackTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashSmashStackTop : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashSmashStackTop.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashSmashStackTop.h" 28 | 29 | @implementation CRLCrashSmashStackTop 30 | 31 | - (NSString *)category { return @"Various"; } 32 | - (NSString *)title { return @"Smash the top of the stack"; } 33 | - (NSString *)desc { return @"" 34 | "Overwrite data above the current stack pointer. This will destroy the current stack trace. " 35 | "Reporting of this crash is expected to fail. Succeeding is basically luck."; 36 | } 37 | 38 | - (void)crash 39 | { 40 | void *sp = NULL; 41 | 42 | #if __i386__ 43 | asm volatile ( "mov %%esp, %0" : "=X" (sp) : : ); 44 | #elif __x86_64__ 45 | asm volatile ( "mov %%rsp, %0" : "=X" (sp) : : ); 46 | #elif __arm__ && __ARM_ARCH == 7 47 | asm volatile ( "mov %0, sp" : "=X" (sp) : : ); 48 | #elif __arm__ && __ARM_ARCH == 6 49 | asm volatile ( "mov %0, sp" : "=X" (sp) : : ); 50 | #elif __arm64__ 51 | asm volatile ( "mov %0, sp" : "=X" (sp) : : ); 52 | #endif 53 | 54 | memset(sp - 0x100, 0xa5, 0x100); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashStackGuard.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | #import "CRLCrash.h" 27 | 28 | @interface CRLCrashStackGuard : CRLCrash 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashStackGuard.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashStackGuard.h" 28 | 29 | @implementation CRLCrashStackGuard 30 | 31 | - (NSString *)category { return @"SIGSEGV"; } 32 | - (NSString *)title { return @"Stack overflow"; } 33 | - (NSString *)desc { return @"" 34 | "Execute an infinitely recursive method, which overflows the stack and " 35 | "causes a crash by attempting to write to the guard page at the end."; 36 | } 37 | 38 | - (void)crash { 39 | [self crash]; 40 | 41 | /* This is unreachable, but prevents clang from applying TCO to the above when 42 | * optimization is enabled. */ 43 | NSLog(@"I'm here from the tail call prevention department."); 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashSwift.swift: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | import Foundation 28 | 29 | class CRLCrashSwift: CRLCrash { 30 | override var category: String { return "Various"; } 31 | override var title: String { return "Swift"; } 32 | override var desc: String { return "Trigger a crash from inside a Swift method."; } 33 | override func crash() { 34 | let buf: UnsafeMutablePointer? = nil; 35 | 36 | buf![1] = 1; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashTrap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashTrap : CRLCrash 30 | 31 | - (void)crash __attribute__((noreturn)); 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashTrap.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashTrap.h" 28 | 29 | @implementation CRLCrashTrap 30 | 31 | - (NSString *)category { return @"SIGTRAP"; } 32 | - (NSString *)title { return @"Call __builtin_trap()"; } 33 | - (NSString *)desc { return @"Call __builtin_trap() to generate a trap exception."; } 34 | 35 | - (void)crash __attribute__((noreturn)) 36 | { 37 | __builtin_trap(); 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashUndefInst.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLCrashUndefInst : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLCrashUndefInst.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrashUndefInst.h" 28 | 29 | @implementation CRLCrashUndefInst 30 | 31 | - (NSString *)category { return @"SIGILL"; } 32 | - (NSString *)title { return @"Execute an undefined instruction"; } 33 | - (NSString *)desc { return @"Attempt to execute an instructiondinn not to be defined on the current architecture."; } 34 | 35 | - (void)crash 36 | { 37 | #if __i386__ 38 | asm volatile ( "ud2" : : : ); 39 | #elif __x86_64__ 40 | asm volatile ( "ud2" : : : ); 41 | #elif __arm__ && __ARM_ARCH == 7 && __thumb__ 42 | asm volatile ( ".word 0xde00" : : : ); 43 | #elif __arm__ && __ARM_ARCH == 7 44 | asm volatile ( ".long 0xf7f8a000" : : : ); 45 | #elif __arm__ && __ARM_ARCH == 6 && __thumb__ 46 | asm volatile ( ".word 0xde00" : : : ); 47 | #elif __arm__ && __ARM_ARCH == 6 48 | asm volatile ( ".long 0xf7f8a000" : : : ); 49 | #elif __arm64__ 50 | asm volatile ( ".long 0xf7f8a000" : : : ); 51 | #endif 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /CrashProbe/CRLFramelessDWARF.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLCrash.h" 28 | 29 | @interface CRLFramelessDWARF : CRLCrash 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /CrashProbe/CRLFramelessDWARF.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLFramelessDWARF.h" 28 | 29 | /* Our assembly implemented test function */ 30 | extern void CRLFramelessDWARF_test(); 31 | 32 | /* Called by the assembly code paths to trigger the actual NULL dereference */ 33 | extern void CRLFramelessDWARF_test_crash (void); 34 | void CRLFramelessDWARF_test_crash (void) { 35 | *((volatile uint8_t *) NULL) = 0xFF; 36 | } 37 | 38 | @implementation CRLFramelessDWARF 39 | 40 | - (NSString *)category { return @"Various"; } 41 | - (NSString *)title { return @"DWARF Unwinding"; } 42 | - (NSString *)desc { return @"" 43 | "Trigger a crash in a frame that requires DWARF or Compact Unwind support to correctly unwind. " 44 | "Unwinders that do not support DWARF will terminate on the second frame. " 45 | "The tests will fail for all unwinders on ARMv6 and ARMv7 (DWARF/eh_frame is unsupported). "; 46 | } 47 | 48 | - (void)crash { 49 | CRLFramelessDWARF_test(); 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /CrashProbe/CRLFramelessDWARF_arm32.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Extracted from PLCrashReporter's 1.2-RC2 frame unwinding test cases. 3 | * 4 | * Copyright (c) 2013-2014 Plausible Labs, Inc. All rights reserved. 5 | * Copyright (c) 2008-2011 Apple Inc. All rights reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | */ 22 | 23 | #ifdef __arm__ 24 | .text 25 | 26 | .align 2 27 | .globl _CRLFramelessDWARF_test 28 | _CRLFramelessDWARF_test: 29 | // iOS/ARM doesn't support shipping eh_frame/compact unwind data, 30 | // so we trigger the bug here, but provide no hand-generated DWARF 31 | // data to allow unwinding. 32 | LT0_start: 33 | push {r4, r5} 34 | LT0_sub_sp: 35 | mov r4, fp // Save FP 36 | mov r5, lr // Save LR 37 | eor lr, lr // Zero LR 38 | eor r7, r7 // Zero FP 39 | 40 | bl _CRLFramelessDWARF_test_crash 41 | 42 | mov fp, r4 // Restore FP 43 | mov lr, r5 // Restore LR 44 | pop {r4, r5} 45 | mov pc, lr 46 | LT0_end: 47 | 48 | #endif /* __arm__ */ -------------------------------------------------------------------------------- /CrashProbe/CRLFramelessDWARF_arm64.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Extracted from PLCrashReporter's 1.2-RC2 frame unwinding test cases. 3 | * 4 | * Copyright (c) 2013-2014 Plausible Labs, Inc. All rights reserved. 5 | * Copyright (c) 2008-2011 Apple Inc. All rights reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | */ 22 | 23 | #ifdef __arm64__ 24 | 25 | .text 26 | .align 2 27 | .globl _CRLFramelessDWARF_test 28 | _CRLFramelessDWARF_test: 29 | stp x20, x19, [sp, #-16]! 30 | LT1_sub_sp: 31 | mov x19, fp ; Save FP 32 | mov x20, lr ; Save LR 33 | mov fp, xzr ; Overwrite FP 34 | mov lr, xzr ; Overwrite LR 35 | bl _CRLFramelessDWARF_test_crash ; Trigger crash 36 | ldp x20, x19, [sp], #16 37 | mov fp, x19 ; Restore FP 38 | mov lr, x20 ; Restore LR 39 | ret 40 | LT1_end: 41 | 42 | .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 43 | ; Standard CIE for our test functions 44 | EH_frame1: 45 | .set L$set$0,LECIE1-LSCIE1 46 | .long L$set$0 ; Length of Common Information Entry 47 | LSCIE1: 48 | .long 0x0 ; CIE Identifier Tag 49 | .byte 0x1 ; CIE Version 50 | .ascii "zR\0" ; CIE Augmentation 51 | .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor 52 | .byte 0x78 ; sleb128 -8; CIE Data Alignment Factor 53 | .byte 0x1E ; CIE RA Column 54 | .byte 0x1 ; uleb128 0x1; Augmentation size 55 | .byte 0x10 ; FDE Encoding (pcrel) 56 | .byte 0xc ; DW_CFA_def_cfa 57 | .byte 0x1F ; uleb128 31 (x31) 58 | .byte 0x0 ; uleb128 0x0 59 | .align 3 60 | LECIE1: 61 | 62 | ; Generates our common FDE header for register-saved test cases. 63 | ; Arguments: 64 | ; 0 - Test number (eg, 0, 1, 2). Used to resolve local label names for 65 | ; the given test, and to name FDE-specific labels. 66 | ; 1 - Test name (eg, x19_x20, no_reg) 67 | ; 2 - Stack size, as a uleb128 value 68 | .macro fde_header 69 | .globl _CRLFramelessDWARF_$1.eh 70 | _CRLFramelessDWARF_$1.eh: 71 | LSFDE$0: 72 | .set Lset0$0,LEFDE$0-LASFDE$0 73 | .long Lset0$0 ; FDE Length 74 | LASFDE$0: 75 | .long LASFDE$0-EH_frame1 ; FDE CIE offset 76 | .quad _CRLFramelessDWARF_$1-. ; FDE initial location 77 | .set Lset1$0,LT$0_end-_CRLFramelessDWARF_$1 78 | .quad Lset1$0 ; FDE address range 79 | .byte 0x0 ; uleb128 0x0; Augmentation size 80 | .byte 0x4 ; DW_CFA_advance_loc4 81 | .set Lset2$0,LT$0_sub_sp-_CRLFramelessDWARF_$1 82 | .long Lset2$0 83 | .byte 0xe ; DW_CFA_def_cfa_offset 84 | .byte $2 ; uleb128 stack offset 85 | .endmacro 86 | 87 | ; Generates our common FDE printer 88 | ; Arguments: 89 | ; 0 - Test number (eg, 0, 1, 2). 90 | .macro fde_footer 91 | .align 3 92 | LEFDE$0: 93 | .endmacro 94 | 95 | ; DW_CFA_register rules appear to trigger an ld bug: 96 | ; "could not create compact unwind for _CRLFramelessDWARF_test: saved registers do not fit in stack size" 97 | ; We're only saving two register on the stack, so perhaps ld64 register 98 | ; counting code incorrectly assumes DW_CFA_register consumes stack space. 99 | fde_header 1, test, 0x10 100 | .byte 0x93 ; DW_CFA_offset, column 0x13 101 | .byte 0x2 ; uleb128 0x2 102 | .byte 0x94 ; DW_CFA_offset, column 0x14 103 | .byte 0x3 ; uleb128 0x3 104 | .byte 0x09 ; DW_CFA_register 105 | .byte 0x1D ; uleb128 29 (fp) 106 | .byte 0x13 ; uleb128 13 (x19) 107 | .byte 0x09 ; DW_CFA_register 108 | .byte 0x1E ; uleb128 29 (lr) 109 | .byte 0x14 ; uleb128 13 (x20) 110 | fde_footer 1 111 | 112 | #endif /* __arm64__ */ -------------------------------------------------------------------------------- /CrashProbe/CRLFramelessDWARF_i386.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Extracted from PLCrashReporter's 1.2-RC2 frame unwinding test cases. 3 | * 4 | * Copyright (c) 2013-2014 Plausible Labs, Inc. All rights reserved. 5 | * Copyright (c) 2008-2011 Apple Inc. All rights reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | */ 22 | 23 | #ifdef __i386__ 24 | 25 | .text 26 | 27 | # Frameless, save esi, edi, ebp 28 | .globl _CRLFramelessDWARF_test 29 | _CRLFramelessDWARF_test: 30 | LFB6: 31 | subl $28, %esp 32 | LCFI17: 33 | movl %esi, 16(%esp) 34 | LCFI18: 35 | movl %edi, 20(%esp) 36 | LCFI19: 37 | movl %ebp, 24(%esp) 38 | LCFI20: 39 | movl $0, %esi 40 | movl $0, %edi 41 | movl $0, %ebp 42 | 43 | call _CRLFramelessDWARF_test_crash 44 | 45 | movl 16(%esp), %esi 46 | movl 20(%esp), %edi 47 | movl 24(%esp), %ebp 48 | addl $28, %esp 49 | ret 50 | LFE6: 51 | 52 | .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 53 | EH_frame1: 54 | .set L$set$0,LECIE1-LSCIE1 55 | .long L$set$0 # Length of Common Information Entry 56 | LSCIE1: 57 | .long 0x0 # CIE Identifier Tag 58 | .byte 0x1 # CIE Version 59 | .ascii "zR\0" # CIE Augmentation 60 | .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor 61 | .byte 0x7c # sleb128 -4; CIE Data Alignment Factor 62 | .byte 0x8 # CIE RA Column 63 | .byte 0x1 # uleb128 0x1; Augmentation size 64 | .byte 0x10 # FDE Encoding (pcrel) 65 | .byte 0xc # DW_CFA_def_cfa 66 | .byte 0x5 # uleb128 0x5 67 | .byte 0x4 # uleb128 0x4 68 | .byte 0x88 # DW_CFA_offset, column 0x8 69 | .byte 0x1 # uleb128 0x1 70 | .align 2 71 | LECIE1: 72 | 73 | .globl _CRLFramelessDWARF_test.eh 74 | _CRLFramelessDWARF_test.eh: 75 | LSFDE17: 76 | .set L$set$28,LEFDE17-LASFDE17 77 | .long L$set$28 # FDE Length 78 | LASFDE17: 79 | .long LASFDE17-EH_frame1 # FDE CIE offset 80 | .long LFB6-. # FDE initial location 81 | .set L$set$29,LFE6-LFB6 82 | .long L$set$29 # FDE address range 83 | .byte 0x0 # uleb128 0x0; Augmentation size 84 | .byte 0x4 # DW_CFA_advance_loc4 85 | .set L$set$30,LCFI17-LFB6 86 | .long L$set$30 87 | .byte 0xe # DW_CFA_def_cfa_offset 88 | .byte 0x20 # uleb128 0x20 89 | .byte 0x4 # DW_CFA_advance_loc4 90 | .set L$set$31,LCFI20-LCFI17 91 | .long L$set$31 92 | .byte 0x84 # DW_CFA_offset, column 0x4 93 | .byte 0x2 # uleb128 0x2 94 | .byte 0x87 # DW_CFA_offset, column 0x7 95 | .byte 0x3 # uleb128 0x3 96 | .byte 0x86 # DW_CFA_offset, column 0x6 97 | .byte 0x4 # uleb128 0x4 98 | .align 2 99 | LEFDE17: 100 | 101 | #endif /* __i386__ */ -------------------------------------------------------------------------------- /CrashProbe/CRLFramelessDWARF_x86_64.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Extracted from PLCrashReporter's 1.2-RC2 frame unwinding test cases. 3 | * 4 | * Copyright (c) 2013-2014 Plausible Labs, Inc. All rights reserved. 5 | * Copyright (c) 2008-2011 Apple Inc. All rights reserved. 6 | * 7 | * This file contains Original Code and/or Modifications of Original Code 8 | * as defined in and that are subject to the Apple Public Source License 9 | * Version 2.0 (the 'License'). You may not use this file except in 10 | * compliance with the License. Please obtain a copy of the License at 11 | * http://www.opensource.apple.com/apsl/ and read it before using this 12 | * file. 13 | * 14 | * The Original Code and all software distributed under the License are 15 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 19 | * Please see the License for the specific language governing rights and 20 | * limitations under the License. 21 | */ 22 | 23 | #ifdef __x86_64__ 24 | 25 | .text 26 | .globl _CRLFramelessDWARF_test 27 | _CRLFramelessDWARF_test: 28 | # Frameless, saved rbx and rbp 29 | LFB7: 30 | movq %rbx, -16(%rsp) 31 | LCFI8: 32 | movq %rbp, -8(%rsp) 33 | LCFI9: 34 | subq $24, %rsp 35 | LCFI10: 36 | movq $0, %rbp 37 | movq $0, %rbx 38 | call _CRLFramelessDWARF_test_crash 39 | movq 8(%rsp), %rbx 40 | movq 16(%rsp), %rbp 41 | addq $24, %rsp 42 | ret 43 | LFE7: 44 | 45 | .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 46 | EH_frame1: 47 | .set L$set$0,LECIE1-LSCIE1 48 | .long L$set$0 # Length of Common Information Entry 49 | LSCIE1: 50 | .long 0x0 # CIE Identifier Tag 51 | .byte 0x1 # CIE Version 52 | .ascii "zR\0" # CIE Augmentation 53 | .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor 54 | .byte 0x78 # sleb128 -8; CIE Data Alignment Factor 55 | .byte 0x10 # CIE RA Column 56 | .byte 0x1 # uleb128 0x1; Augmentation size 57 | .byte 0x10 # FDE Encoding (pcrel) 58 | .byte 0xc # DW_CFA_def_cfa 59 | .byte 0x7 # uleb128 0x7 60 | .byte 0x8 # uleb128 0x8 61 | .byte 0x90 # DW_CFA_offset, column 0x10 62 | .byte 0x1 # uleb128 0x1 63 | .align 3 64 | LECIE1: 65 | 66 | .globl _CRLFramelessDWARF_test.eh 67 | _CRLFramelessDWARF_test.eh: 68 | LSFDE14: 69 | .set L$set$21,LEFDE14-LASFDE14 70 | .long L$set$21 # FDE Length 71 | LASFDE14: 72 | .long LASFDE14-EH_frame1 # FDE CIE offset 73 | .quad LFB7-. # FDE initial location 74 | .set L$set$22,LFE7-LFB7 75 | .quad L$set$22 # FDE address range 76 | .byte 0x0 # uleb128 0x0; Augmentation size 77 | .byte 0x4 # DW_CFA_advance_loc4 78 | .set L$set$23,LCFI10-LFB7 79 | .long L$set$23 80 | .byte 0xe # DW_CFA_def_cfa_offset 81 | .byte 0x20 # uleb128 0x20 82 | .byte 0x86 # DW_CFA_offset, column 0x6 83 | .byte 0x2 # uleb128 0x2 84 | .byte 0x83 # DW_CFA_offset, column 0x3 85 | .byte 0x3 # uleb128 0x3 86 | .align 3 87 | LEFDE14: 88 | 89 | #endif /* __x86_64__ */ -------------------------------------------------------------------------------- /CrashProbe/CRLMainWindow.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 117 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | Perhaps there shall be some text in this text field, such that there will be an example of the wrapping text field's wrappiness for testing the wrapping of the wrapping text field. What can I say? Let's add at least two more lines of text to this silly stupid thing so there's more test text to work with. 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /CrashProbe/CRLMainWindowController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import 28 | 29 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 30 | @class CRLCrashListViewController; 31 | #endif 32 | 33 | @interface CRLMainWindowController : NSWindowController 34 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 35 | { 36 | NSOutlineView *_crashList; 37 | NSSplitView *_splitView; 38 | NSTextField *_titleText; 39 | NSTextField *_detailText; 40 | NSImageView *_detailImage; 41 | NSButton *_crashButton; 42 | CRLCrashListViewController *_listController; 43 | } 44 | #endif 45 | @end 46 | -------------------------------------------------------------------------------- /CrashProbe/CRLMainWindowController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 3 | * All rights reserved. 4 | * 5 | * Permission is hereby granted, free of charge, to any person 6 | * obtaining a copy of this software and associated documentation 7 | * files (the "Software"), to deal in the Software without 8 | * restriction, including without limitation the rights to use, 9 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the 11 | * Software is furnished to do so, subject to the following 12 | * conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #import "CRLMainWindowController.h" 28 | #import "CRLCrashListViewController.h" 29 | #import 30 | 31 | @interface CRLMainWindowController () 32 | 33 | @property(nonatomic,strong) IBOutlet NSOutlineView *crashList; 34 | @property(nonatomic,strong) IBOutlet NSSplitView *splitView; 35 | @property(nonatomic,strong) IBOutlet NSTextField *titleText; 36 | @property(nonatomic,strong) IBOutlet NSTextField *detailText; 37 | @property(nonatomic,strong) IBOutlet NSImageView *detailImage; 38 | @property(nonatomic,strong) IBOutlet NSButton *crashButton; 39 | @property(nonatomic,strong) CRLCrashListViewController *listController; 40 | 41 | @end 42 | 43 | @implementation CRLMainWindowController 44 | 45 | #if __i386__ 46 | @synthesize crashList = _crashList, crashButton = _crashButton, listController = _listController, 47 | splitView = _splitView, titleText = _titleText, detailText = _detailText, detailImage = _detailImage; 48 | #endif 49 | 50 | - (id)init 51 | { 52 | return [super initWithWindowNibName:@"CRLMainWindow"]; 53 | } 54 | 55 | - (void)windowDidLoad 56 | { 57 | [super windowDidLoad]; 58 | #if __i386__ && !TARGET_IPHONE_SIMULATOR 59 | self.listController = [[[CRLCrashListViewController alloc] initWithOutlineView:self.crashList] autorelease]; 60 | #else 61 | self.listController = [[CRLCrashListViewController alloc] initWithOutlineView:self.crashList]; 62 | #endif 63 | self.listController.delegate = self; 64 | [self.listController loadView]; 65 | self.crashButton.target = self; 66 | self.crashButton.action = @selector(causeCrash:); 67 | [self controller:self.listController didSelectCrash:nil]; 68 | } 69 | 70 | - (void)causeCrash:(id)sender 71 | { 72 | [self.listController.selectedCrash crash]; 73 | } 74 | 75 | - (void)controller:(CRLCrashListViewController *)controller didSelectCrash:(CRLCrash *)crash 76 | { 77 | self.titleText.stringValue = crash.title ?: @""; 78 | self.detailText.stringValue = crash.desc ?: @""; 79 | // self.detailImage.image = crash.animation; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /CrashProbe/CrashLib-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "CRLCrash.h" 6 | -------------------------------------------------------------------------------- /CrashProbe/CrashProbe-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | CrashProbe 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.utilities 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSHumanReadableCopyright 30 | Copyright © 2014 Bit Stadium GmbH. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /CrashProbe/CrashProbe-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'HockeyDemo' target in the 'HockeyDemo' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /CrashProbe/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf190 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \paperw11900\paperh16840\vieww9600\viewh8400\viewkind0 5 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 6 | 7 | \f0\b\fs24 \cf0 Engineering: 8 | \b0 \ 9 | Bit Stadium GmbH\ 10 | } -------------------------------------------------------------------------------- /CrashProbe/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /CrashProbe/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HockeyDemo 4 | // 5 | // Created by Gwynne Raskind on 2/18/13. 6 | // Copyright (c) 2013 Bit Stadium GmbH. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ## Licenses 2 | 3 | The CrashProbe is provided under the following license: 4 | 5 | The MIT License 6 | Copyright (c) 2014 HockeyApp, Bit Stadium GmbH. 7 | All rights reserved. 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the "Software"), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Introduction 2 | 3 | [CrashProbe](http://crashprobe.com/) provides a set of test crashes that can be used to test crash reporting SDKs and symbolication implementations on iOS and OS X. 4 | 5 | The project has been developed using Xcode 5.1.1 and has been tested with OS X 10.9.2 and iOS 7.1.1. 6 | 7 | ## Setup 8 | 9 | 1. Clone this repository. 10 | 2. Open the project in Xcode. 11 | 3. Integrate your crash reporting SDK into the required platform target (`CrashProbe` for OS X and `CrashProbeiOS` for iOS). 12 | 4. Build the app using the `Release` build configuration and install it on a device. 13 | 14 | Either use `Archive` or `Build for Profiling` and copy the app bundle onto the device. Using `Debug` build configuration will result in different results due to disabled compiler optimizations. 15 | 5. Start the app without the debugger being attached. 16 | 6. Choose a crash and trigger it. 17 | 7. Start the app again, the integrated SDK should now upload the crash report to its server. 18 | 8. Go back to step 5. and process the next crash. Otherwise continue with step 9. 19 | 9. Symbolicate the crash report(s). 20 | 10. Compare the symbolicated crash report(s) with the data available on the [CrashProbe](http://crashprobe.com/) website. 21 | 22 | ## Disclaimer 23 | 24 | The suite of tests was developed by [Bit Stadium GmbH](http://hockeyapp.net/) for the [HockeyApp](http://hockeyapp.net) service. 25 | 26 | ## Contributing 27 | 28 | ### Code of Conduct 29 | 30 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 31 | 32 | ### Contributor License 33 | 34 | You must sign a [Contributor License Agreement](https://cla.microsoft.com/) before submitting your pull request. To complete the Contributor License Agreement (CLA), you will need to submit a request via the [form](https://cla.microsoft.com/) and then electronically sign the CLA when you receive the email containing the link to the document. You need to sign the CLA only once to cover submission to any Microsoft OSS project. 35 | 36 | ## License 37 | 38 | This project is released under the MIT license. 39 | --------------------------------------------------------------------------------