Skip to content

Commit

Permalink
Check in initial source code.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaclach committed Nov 6, 2022
1 parent 32126ea commit 48d544c
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 0 deletions.
296 changes: 296 additions & 0 deletions crashdump.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {

/* Begin PBXBuildFile section */
8B167F0229181988004C7C12 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B167F0129181988004C7C12 /* main.m */; };
8B167F0B2918220E004C7C12 /* OSAnalytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8B167F0A2918220E004C7C12 /* OSAnalytics.framework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
8B167EFC29181988004C7C12 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
8B167EFE29181988004C7C12 /* crashdump */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = crashdump; sourceTree = BUILT_PRODUCTS_DIR; };
8B167F0129181988004C7C12 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8B167F0A2918220E004C7C12 /* OSAnalytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OSAnalytics.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/OSAnalytics.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
8B167EFB29181988004C7C12 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8B167F0B2918220E004C7C12 /* OSAnalytics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
8B167EF529181988004C7C12 = {
isa = PBXGroup;
children = (
8B167F0029181988004C7C12 /* crashdump */,
8B167EFF29181988004C7C12 /* Products */,
8B167F092918220E004C7C12 /* Frameworks */,
);
sourceTree = "<group>";
};
8B167EFF29181988004C7C12 /* Products */ = {
isa = PBXGroup;
children = (
8B167EFE29181988004C7C12 /* crashdump */,
);
name = Products;
sourceTree = "<group>";
};
8B167F0029181988004C7C12 /* crashdump */ = {
isa = PBXGroup;
children = (
8B167F0129181988004C7C12 /* main.m */,
);
path = crashdump;
sourceTree = "<group>";
};
8B167F092918220E004C7C12 /* Frameworks */ = {
isa = PBXGroup;
children = (
8B167F0A2918220E004C7C12 /* OSAnalytics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
8B167EFD29181988004C7C12 /* crashdump */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8B167F0529181988004C7C12 /* Build configuration list for PBXNativeTarget "crashdump" */;
buildPhases = (
8B167EFA29181988004C7C12 /* Sources */,
8B167EFB29181988004C7C12 /* Frameworks */,
8B167EFC29181988004C7C12 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = crashdump;
productName = crashdump;
productReference = 8B167EFE29181988004C7C12 /* crashdump */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
8B167EF629181988004C7C12 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1400;
TargetAttributes = {
8B167EFD29181988004C7C12 = {
CreatedOnToolsVersion = 14.0;
};
};
};
buildConfigurationList = 8B167EF929181988004C7C12 /* Build configuration list for PBXProject "crashdump" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 8B167EF529181988004C7C12;
productRefGroup = 8B167EFF29181988004C7C12 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
8B167EFD29181988004C7C12 /* crashdump */,
);
};
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
8B167EFA29181988004C7C12 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8B167F0229181988004C7C12 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
8B167F0329181988004C7C12 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.3;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
8B167F0429181988004C7C12 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 12.3;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
8B167F0629181988004C7C12 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9SY52WKP32;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SYSTEM_FRAMEWORK_SEARCH_PATHS = $DEVELOPER_SDK_DIR/MacOSX.sdk/System/Library/PrivateFrameworks/;
};
name = Debug;
};
8B167F0729181988004C7C12 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 9SY52WKP32;
ENABLE_HARDENED_RUNTIME = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SYSTEM_FRAMEWORK_SEARCH_PATHS = $DEVELOPER_SDK_DIR/MacOSX.sdk/System/Library/PrivateFrameworks/;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
8B167EF929181988004C7C12 /* Build configuration list for PBXProject "crashdump" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8B167F0329181988004C7C12 /* Debug */,
8B167F0429181988004C7C12 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8B167F0529181988004C7C12 /* Build configuration list for PBXNativeTarget "crashdump" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8B167F0629181988004C7C12 /* Debug */,
8B167F0729181988004C7C12 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 8B167EF629181988004C7C12 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
48 changes: 48 additions & 0 deletions crashdump/main.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// main.m
// crashdump
//
// Created by Dave MacLachlan on 11/6/22.
//

#import <Foundation/Foundation.h>

// Private API for turning crash reports into dictionaries.
// This is valid for at least MacOS 12 and 13.
// This was extracted from:
// /System/Library/PrivateFrameworks/OSAnalytics.framework/Versions/A/OSAnalytics
@interface OSALegacyXform : NSObject
// Takes in a crash report file pointed to by url and returns a dictionary with either
// OSATransformResultReport or OSATransformResultError keys.
+ (NSDictionary<NSString *, id> *)transformURL:(NSURL *)url options:(id)options;
@end

// These are the keys for the dictionary created by OSALegacyXform.
extern NSString *OSATransformResultError;
extern NSString *OSATransformResultReport;

int main(int argc, const char * argv[]) {
@autoreleasepool {
if (argc != 2) {
printf("crashdump <crashreportpath>\n");
return 1;
}
NSString *path = [NSString stringWithUTF8String:argv[1]];
NSURL *url = [NSURL fileURLWithPath:path];
NSDictionary<NSString *, id> *output = [OSALegacyXform transformURL:url options:nil];
NSString *report = output[OSATransformResultReport];
if (report) {
printf("%s", report.UTF8String);
return 0;
}
// uh-oh error occurred converting crash.
// Try to output something with gcc error syntax if we are using this in a script.
NSError *outputError = output[OSATransformResultError];
if (outputError) {
printf("%s: error: %s\n", argv[1], outputError.localizedDescription.UTF8String);
} else {
printf("%s: error: Unable to parse file\n", argv[1]);
}
}
return 1;
}

0 comments on commit 48d544c

Please sign in to comment.