Skip to content

Commit

Permalink
Added console installation.
Browse files Browse the repository at this point in the history
Also moved framework/module stuff to a common area.
  • Loading branch information
kstenerud committed Mar 31, 2016
1 parent 7c1ad09 commit ddbca8d
Show file tree
Hide file tree
Showing 8 changed files with 258 additions and 6 deletions.
26 changes: 25 additions & 1 deletion Mac/KSCrash-Mac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,14 @@
CB8E571A17EB9BA8000C56D3 /* KSCrashInstallationVictory.m in Sources */ = {isa = PBXBuildFile; fileRef = CB8E570F17EB9BA8000C56D3 /* KSCrashInstallationVictory.m */; };
CBA997741C9226DE00D12149 /* KSCrashReportVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = CBA997731C9226DE00D12149 /* KSCrashReportVersion.h */; settings = {ATTRIBUTES = (Private, ); }; };
CBA997751C9226DE00D12149 /* KSCrashReportVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = CBA997731C9226DE00D12149 /* KSCrashReportVersion.h */; settings = {ATTRIBUTES = (Private, ); }; };
CBBD3AA81CAD989400DBB897 /* KSCrashReportFilterStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = CBBD3AA61CAD989400DBB897 /* KSCrashReportFilterStringify.h */; settings = {ATTRIBUTES = (Public, ); }; };
CBBD3AA91CAD989400DBB897 /* KSCrashReportFilterStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = CBBD3AA61CAD989400DBB897 /* KSCrashReportFilterStringify.h */; settings = {ATTRIBUTES = (Public, ); }; };
CBBD3AAA1CAD989400DBB897 /* KSCrashReportFilterStringify.m in Sources */ = {isa = PBXBuildFile; fileRef = CBBD3AA71CAD989400DBB897 /* KSCrashReportFilterStringify.m */; };
CBBD3AAB1CAD989400DBB897 /* KSCrashReportFilterStringify.m in Sources */ = {isa = PBXBuildFile; fileRef = CBBD3AA71CAD989400DBB897 /* KSCrashReportFilterStringify.m */; };
CBBD3AAE1CAD98A300DBB897 /* KSCrashInstallationConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = CBBD3AAC1CAD98A300DBB897 /* KSCrashInstallationConsole.h */; settings = {ATTRIBUTES = (Public, ); }; };
CBBD3AAF1CAD98A300DBB897 /* KSCrashInstallationConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = CBBD3AAC1CAD98A300DBB897 /* KSCrashInstallationConsole.h */; settings = {ATTRIBUTES = (Public, ); }; };
CBBD3AB01CAD98A300DBB897 /* KSCrashInstallationConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = CBBD3AAD1CAD98A300DBB897 /* KSCrashInstallationConsole.m */; };
CBBD3AB11CAD98A300DBB897 /* KSCrashInstallationConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = CBBD3AAD1CAD98A300DBB897 /* KSCrashInstallationConsole.m */; };
DCA19E3418832A7800DCA792 /* KSCrashSentry_MachException.c in Sources */ = {isa = PBXBuildFile; fileRef = DCA19E3318832A7700DCA792 /* KSCrashSentry_MachException.c */; };
DCA19E3518832A8B00DCA792 /* KSCrashSentry_MachException.c in Sources */ = {isa = PBXBuildFile; fileRef = DCA19E3318832A7700DCA792 /* KSCrashSentry_MachException.c */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -568,6 +576,10 @@
CB8E571B17EBA8D9000C56D3 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
CB8E571D17EBA8DF000C56D3 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
CBA997731C9226DE00D12149 /* KSCrashReportVersion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KSCrashReportVersion.h; path = ../../Source/KSCrash/Recording/KSCrashReportVersion.h; sourceTree = "<group>"; };
CBBD3AA61CAD989400DBB897 /* KSCrashReportFilterStringify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KSCrashReportFilterStringify.h; path = /Users/karl/Projects/KSCrash/iOS/KSCrash/../../Source/KSCrash/Reporting/Filters/KSCrashReportFilterStringify.h; sourceTree = "<absolute>"; };
CBBD3AA71CAD989400DBB897 /* KSCrashReportFilterStringify.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KSCrashReportFilterStringify.m; path = /Users/karl/Projects/KSCrash/iOS/KSCrash/../../Source/KSCrash/Reporting/Filters/KSCrashReportFilterStringify.m; sourceTree = "<absolute>"; };
CBBD3AAC1CAD98A300DBB897 /* KSCrashInstallationConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KSCrashInstallationConsole.h; path = /Users/karl/Projects/KSCrash/iOS/KSCrash/../../Source/KSCrash/Installations/KSCrashInstallationConsole.h; sourceTree = "<absolute>"; };
CBBD3AAD1CAD98A300DBB897 /* KSCrashInstallationConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = KSCrashInstallationConsole.m; path = /Users/karl/Projects/KSCrash/iOS/KSCrash/../../Source/KSCrash/Installations/KSCrashInstallationConsole.m; sourceTree = "<absolute>"; };
DCA19E3318832A7700DCA792 /* KSCrashSentry_MachException.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = KSCrashSentry_MachException.c; path = ../../Source/KSCrash/Recording/Sentry/KSCrashSentry_MachException.c; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -851,8 +863,8 @@
CB8E561D17EB9AE1000C56D3 /* Crash Reporting */ = {
isa = PBXGroup;
children = (
DCA19E361883322100DCA792 /* Sinks */,
CB8E569F17EB9B4E000C56D3 /* Filters */,
DCA19E361883322100DCA792 /* Sinks */,
CB8E56A017EB9B62000C56D3 /* Tools */,
);
name = "Crash Reporting";
Expand All @@ -864,6 +876,8 @@
CB8E570517EB9BA8000C56D3 /* KSCrashInstallation+Private.h */,
CB8E570617EB9BA8000C56D3 /* KSCrashInstallation.h */,
CB8E570717EB9BA8000C56D3 /* KSCrashInstallation.m */,
CBBD3AAC1CAD98A300DBB897 /* KSCrashInstallationConsole.h */,
CBBD3AAD1CAD98A300DBB897 /* KSCrashInstallationConsole.m */,
CB8E570817EB9BA8000C56D3 /* KSCrashInstallationEmail.h */,
CB8E570917EB9BA8000C56D3 /* KSCrashInstallationEmail.m */,
CB8E570A17EB9BA8000C56D3 /* KSCrashInstallationQuincyHockey.h */,
Expand Down Expand Up @@ -966,6 +980,8 @@
CB8E56AC17EB9B7E000C56D3 /* KSCrashReportFilterJSON.m */,
CB8E56AD17EB9B7E000C56D3 /* KSCrashReportFilterSets.h */,
CB8E56AE17EB9B7E000C56D3 /* KSCrashReportFilterSets.m */,
CBBD3AA61CAD989400DBB897 /* KSCrashReportFilterStringify.h */,
CBBD3AA71CAD989400DBB897 /* KSCrashReportFilterStringify.m */,
DCA19E37188338C400DCA792 /* Tools */,
);
name = Filters;
Expand Down Expand Up @@ -1057,6 +1073,7 @@
CB6240E417EBCA74006471F1 /* KSZombie.h in Headers */,
CB6240C517EBCA74006471F1 /* KSCrashSentry_User.h in Headers */,
CB6240D117EBCA74006471F1 /* KSLogger.h in Headers */,
CBBD3AA91CAD989400DBB897 /* KSCrashReportFilterStringify.h in Headers */,
CB6240E317EBCA74006471F1 /* KSSysCtl.h in Headers */,
CB62411017EBCA74006471F1 /* KSSingleton.h in Headers */,
CB2686191C694E4400EE4EB3 /* AlignOf.h in Headers */,
Expand All @@ -1069,6 +1086,7 @@
CB6240BF17EBCA74006471F1 /* KSCrashSentry_NSException.h in Headers */,
CB26862E1C694E4400EE4EB3 /* Punycode.h in Headers */,
CB6240B117EBCA74006471F1 /* KSCrashState.h in Headers */,
CBBD3AAF1CAD98A300DBB897 /* KSCrashInstallationConsole.h in Headers */,
CB2686121C694E4400EE4EB3 /* Optional.h in Headers */,
CB6240C917EBCA74006471F1 /* KSBacktrace.h in Headers */,
CB6240AD17EBCA74006471F1 /* KSCrashReport.h in Headers */,
Expand Down Expand Up @@ -1150,6 +1168,7 @@
CB8E563A17EB9AFD000C56D3 /* KSSystemInfoC.h in Headers */,
CB8E568117EB9B43000C56D3 /* KSBacktrace_Private.h in Headers */,
CB8E56F317EB9B89000C56D3 /* KSSingleton.h in Headers */,
CBBD3AA81CAD989400DBB897 /* KSCrashReportFilterStringify.h in Headers */,
CB8E568517EB9B43000C56D3 /* KSJSONCodec.h in Headers */,
CB8E565017EB9B35000C56D3 /* KSCrashSentry_Deadlock.h in Headers */,
CB8E56F917EB9B89000C56D3 /* NSError+SimpleConstructor.h in Headers */,
Expand All @@ -1162,6 +1181,7 @@
CB8E568F17EB9B43000C56D3 /* KSMachApple.h in Headers */,
CB8E564D17EB9B35000C56D3 /* KSCrashSentry.h in Headers */,
CB8E565417EB9B35000C56D3 /* KSCrashSentry_NSException.h in Headers */,
CBBD3AAE1CAD98A300DBB897 /* KSCrashInstallationConsole.h in Headers */,
CB8E568817EB9B43000C56D3 /* KSLogger.h in Headers */,
CB8E563117EB9AFD000C56D3 /* KSCrashReport.h in Headers */,
CB8E569217EB9B43000C56D3 /* KSObjCApple.h in Headers */,
Expand Down Expand Up @@ -1350,6 +1370,7 @@
CB6240D517EBCA74006471F1 /* KSMach_Arm.c in Sources */,
CB6240B517EBCA74006471F1 /* KSSystemInfo.m in Sources */,
CB62412217EBCA74006471F1 /* KSCrashInstallationStandard.m in Sources */,
CBBD3AB11CAD98A300DBB897 /* KSCrashInstallationConsole.m in Sources */,
CB6240CB17EBCA74006471F1 /* KSFileUtils.c in Sources */,
CB6240A917EBCA74006471F1 /* KSCrashC.c in Sources */,
CB6240ED17EBCA74006471F1 /* KSCrashReportFilterAppleFmt.m in Sources */,
Expand All @@ -1358,6 +1379,7 @@
CB2685F41C694DB200EE4EB3 /* NSString+Demangle.mm in Sources */,
CB62412417EBCA74006471F1 /* KSCrashInstallationVictory.m in Sources */,
CB62410917EBCA74006471F1 /* KSCString.m in Sources */,
CBBD3AAB1CAD989400DBB897 /* KSCrashReportFilterStringify.m in Sources */,
CB62412017EBCA74006471F1 /* KSCrashInstallationQuincyHockey.m in Sources */,
CB6240F917EBCA74006471F1 /* KSCrashReportSinkEMail.m in Sources */,
DCA19E3518832A8B00DCA792 /* KSCrashSentry_MachException.c in Sources */,
Expand Down Expand Up @@ -1419,6 +1441,7 @@
CB8E56CC17EB9B7E000C56D3 /* KSCrashReportSinkQuincyHockey.m in Sources */,
CB8E56CE17EB9B7E000C56D3 /* KSCrashReportSinkStandard.m in Sources */,
CB8E564C17EB9B35000C56D3 /* KSCrashSentry.c in Sources */,
CBBD3AB01CAD98A300DBB897 /* KSCrashInstallationConsole.m in Sources */,
CB8E569C17EB9B43000C56D3 /* KSZombie.m in Sources */,
CB8E56C417EB9B7E000C56D3 /* KSCrashReportFilterJSON.m in Sources */,
CB8E56C217EB9B7E000C56D3 /* KSCrashReportFilterGZip.m in Sources */,
Expand All @@ -1427,6 +1450,7 @@
CB2685F31C694DB200EE4EB3 /* NSString+Demangle.mm in Sources */,
CB8E56C017EB9B7E000C56D3 /* KSCrashReportFilterBasic.m in Sources */,
CB8E56C617EB9B7E000C56D3 /* KSCrashReportFilterSets.m in Sources */,
CBBD3AAA1CAD989400DBB897 /* KSCrashReportFilterStringify.m in Sources */,
CB8E564F17EB9B35000C56D3 /* KSCrashSentry_CPPException.mm in Sources */,
CB8E56EA17EB9B89000C56D3 /* KSCrashCallCompletion.m in Sources */,
DCA19E3418832A7800DCA792 /* KSCrashSentry_MachException.c in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import "KSCrashC.h"
#import "KSCrashContext.h"
#import "KSCrashInstallation.h"
#import "KSCrashInstallationConsole.h"
#import "KSCrashInstallationEmail.h"
#import "KSCrashInstallationQuincyHockey.h"
#import "KSCrashInstallationStandard.h"
Expand All @@ -26,6 +27,7 @@
#import "KSCrashReportFilterGZip.h"
#import "KSCrashReportFilterJSON.h"
#import "KSCrashReportFilterSets.h"
#import "KSCrashReportFilterStringify.h"
#import "KSCrashReportSinkConsole.h"
#import "KSCrashReportSinkEMail.h"
#import "KSCrashReportSinkQuincyHockey.h"
Expand Down
File renamed without changes.
37 changes: 37 additions & 0 deletions Source/KSCrash/Installations/KSCrashInstallationConsole.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// KSCrashInstallationConsole.h
// KSCrash-iOS
//
// Copyright (c) 2012 Karl Stenerud. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall remain in place
// in this source code.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#import "KSCrashInstallation.h"

/** Prints all reports to the console.
* This class is intended for testing purposes.
*/
@interface KSCrashInstallationConsole : KSCrashInstallation

@property(nonatomic,readwrite) BOOL printAppleFormat;

+ (instancetype) sharedInstance;

@end
70 changes: 70 additions & 0 deletions Source/KSCrash/Installations/KSCrashInstallationConsole.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// KSCrashInstallationConsole.m
// KSCrash-iOS
//
// Copyright (c) 2012 Karl Stenerud. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall remain in place
// in this source code.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#import "KSCrashInstallationConsole.h"
#import "KSCrashInstallation+Private.h"
#import "KSCrashReportSinkConsole.h"
#import "KSCrashReportFilterAppleFmt.h"
#import "KSCrashReportFilterJSON.h"
#import "KSCrashReportFilterStringify.h"
#import "KSSingleton.h"

@implementation KSCrashInstallationConsole

IMPLEMENT_EXCLUSIVE_SHARED_INSTANCE(KSCrashInstallationConsole)

@synthesize printAppleFormat = _printAppleFormat;

- (id) init
{
if((self = [super initWithRequiredProperties:nil]))
{
self.printAppleFormat = NO;
}
return self;
}

- (id<KSCrashReportFilter>) sink
{
id<KSCrashReportFilter> formatFilter;
if(self.printAppleFormat)
{
formatFilter = [KSCrashReportFilterAppleFmt filterWithReportStyle:KSAppleReportStyleSymbolicated];
}
else
{
formatFilter = [KSCrashReportFilterPipeline filterWithFilters:
[KSCrashReportFilterJSONEncode filterWithOptions:KSJSONEncodeOptionPretty | KSJSONEncodeOptionSorted],
[KSCrashReportFilterStringify new],
nil];
}

return [KSCrashReportFilterPipeline filterWithFilters:
formatFilter,
[KSCrashReportSinkConsole new],
nil];
}

@end
34 changes: 34 additions & 0 deletions Source/KSCrash/Reporting/Filters/KSCrashReportFilterStringify.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// KSCrashReportFilterStringify.h
// KSCrash
//
// Copyright (c) 2012 Karl Stenerud. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall remain in place
// in this source code.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#import "KSCrashReportFilter.h"

/** Converts objects into strings.
*/
@interface KSCrashReportFilterStringify : NSObject <KSCrashReportFilter>

+ (KSCrashReportFilterStringify*) filter;

@end
61 changes: 61 additions & 0 deletions Source/KSCrash/Reporting/Filters/KSCrashReportFilterStringify.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// KSCrashReportFilterStringify.m
// KSCrash
//
// Copyright (c) 2012 Karl Stenerud. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall remain in place
// in this source code.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

#import "KSCrashReportFilterStringify.h"
#import "KSCrashCallCompletion.h"

@implementation KSCrashReportFilterStringify

+ (KSCrashReportFilterStringify*) filter
{
return [[self alloc] init];
}

- (NSString*) stringifyObject:(id) object
{
if([object isKindOfClass:[NSString class]])
{
return object;
}
if([object isKindOfClass:[NSData class]])
{
return [[NSString alloc] initWithData:object encoding:NSUTF8StringEncoding];
}
return [NSString stringWithFormat:@"%@", object];
}

- (void) filterReports:(NSArray*) reports
onCompletion:(KSCrashReportFilterCompletion) onCompletion
{
NSMutableArray* filteredReports = [NSMutableArray arrayWithCapacity:[reports count]];
for(id report in reports)
{
[filteredReports addObject:[self stringifyObject:report]];
}

kscrash_i_callCompletion(onCompletion, filteredReports, YES, nil);
}

@end
Loading

0 comments on commit ddbca8d

Please sign in to comment.