├── .azure-pipelines ├── analyze-and-test-template.yml ├── build-plcrashreporter-1ES.yml ├── build-template.yml └── cocoapods-verification-template.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── problem_report.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── CHANGELOG.md ├── CrashReporter.xcodeproj ├── TemplateIcon.icns ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── CrashReporter Archive.xcscheme │ ├── CrashReporter Documentation.xcscheme │ ├── CrashReporter XCFramework.xcscheme │ ├── CrashReporter iOS Framework.xcscheme │ ├── CrashReporter iOS Universal.xcscheme │ ├── CrashReporter iOS.xcscheme │ ├── CrashReporter macOS Framework.xcscheme │ ├── CrashReporter macOS Static Framework.xcscheme │ ├── CrashReporter macOS.xcscheme │ ├── CrashReporter tvOS Framework.xcscheme │ ├── CrashReporter tvOS Universal.xcscheme │ ├── CrashReporter tvOS.xcscheme │ ├── CrashReporter.xcscheme │ ├── DemoCrash iOS.xcscheme │ ├── DemoCrash macOS.xcscheme │ ├── DemoCrash tvOS.xcscheme │ ├── Fuzz Testing.xcscheme │ └── plcrashutil.xcscheme ├── Dependencies ├── cgmanifest.json ├── protobuf-c │ ├── generate-pb-c.sh │ └── protobuf-c │ │ ├── protobuf-c.c │ │ └── protobuf-c.h └── protobuf.rb ├── Documentation └── Crash Log Format │ ├── IEEEtrantools.sty │ └── PLCrashReportFormat.tex ├── Doxyfile ├── LICENSE ├── Other Sources ├── Crash Demo │ └── main.m ├── Fuzz │ └── fuzz-main.m └── plcrashutil │ └── main.m ├── PLCrashReporter.podspec ├── Package.swift ├── README.md ├── Resources ├── CrashReporter.exp ├── CrashReporter.modulemap ├── Default-568h@2x.png ├── DemoCrash-iOS-Info.plist ├── DemoCrash-iOS.entitlements ├── DemoCrash-macOS-Info.plist ├── DemoCrash-tvOS-Info.plist ├── Info.plist ├── PrivacyInfo.xcprivacy ├── Tests-Info.plist ├── Tests │ ├── PLCrashAsyncCompactUnwindEncodingTests │ │ ├── Makefile │ │ ├── test.c │ │ ├── test.ios │ │ ├── test.macosx │ │ └── test.sim │ └── PLCrashAsyncDwarfEncodingTests │ │ ├── Makefile │ │ ├── README.txt │ │ ├── build-regression-tests.sh │ │ ├── regression-bins │ │ ├── tbin.unwind_test_x86_64_disable_compact_frame.s.1 │ │ ├── tbin.unwind_test_x86_64_frame.s.2 │ │ ├── tbin.unwind_test_x86_64_frame.s.3 │ │ ├── tbin.unwind_test_x86_64_frame.s.4 │ │ ├── tbin.unwind_test_x86_64_frame.s.5 │ │ ├── tbin.unwind_test_x86_64_frameless.s.6 │ │ ├── tbin.unwind_test_x86_64_frameless.s.7 │ │ ├── tbin.unwind_test_x86_64_frameless_big.s.8 │ │ ├── tbin.unwind_test_x86_64_frameless_big.s.9 │ │ ├── tbin.unwind_test_x86_64_unusual.s.10 │ │ ├── tbin.unwind_test_x86_64_unusual.s.11 │ │ ├── tbin.unwind_test_x86_disable_compact_frame.s.12 │ │ ├── tbin.unwind_test_x86_frame.s.13 │ │ ├── tbin.unwind_test_x86_frame.s.14 │ │ ├── tbin.unwind_test_x86_frame.s.15 │ │ ├── tbin.unwind_test_x86_frame.s.16 │ │ ├── tbin.unwind_test_x86_frameless.s.17 │ │ ├── tbin.unwind_test_x86_frameless.s.18 │ │ ├── tbin.unwind_test_x86_frameless_big.s.19 │ │ ├── tbin.unwind_test_x86_frameless_big.s.20 │ │ ├── tbin.unwind_test_x86_unusual.s.21 │ │ └── tbin.unwind_test_x86_unusual.s.22 │ │ ├── regression │ │ ├── unwind_test_main.c │ │ ├── unwind_test_x86.s │ │ ├── unwind_test_x86_64.s │ │ ├── unwind_test_x86_64_disable_compact_frame.s │ │ ├── unwind_test_x86_64_frame.s │ │ ├── unwind_test_x86_64_frameless.s │ │ ├── unwind_test_x86_64_frameless_big.s │ │ ├── unwind_test_x86_64_unusual.s │ │ ├── unwind_test_x86_disable_compact_frame.s │ │ ├── unwind_test_x86_frame.s │ │ ├── unwind_test_x86_frameless.s │ │ ├── unwind_test_x86_frameless_big.s │ │ └── unwind_test_x86_unusual.s │ │ ├── test.c │ │ ├── test.ios │ │ ├── test.macosx │ │ └── test.sim └── fuzz_report.plcrash ├── SECURITY.md ├── Scripts ├── build-framework.sh ├── combine-frameworks.sh ├── combine-libraries.sh ├── combine-xcframework.sh ├── copy-products.sh ├── create-archive.sh ├── generate-documentation.sh └── verify-modifications.sh ├── Source ├── CrashReporter.h ├── CrashReporter.m ├── CrashReporterFramework.m ├── PLCrashAsync.c ├── PLCrashAsync.h ├── PLCrashAsyncCompactUnwindEncoding.c ├── PLCrashAsyncCompactUnwindEncoding.h ├── PLCrashAsyncDwarfCFAState.cpp ├── PLCrashAsyncDwarfCFAState.hpp ├── PLCrashAsyncDwarfCFAStateEvaluation.cpp ├── PLCrashAsyncDwarfCIE.cpp ├── PLCrashAsyncDwarfCIE.hpp ├── PLCrashAsyncDwarfEncoding.cpp ├── PLCrashAsyncDwarfEncoding.hpp ├── PLCrashAsyncDwarfExpression.cpp ├── PLCrashAsyncDwarfExpression.hpp ├── PLCrashAsyncDwarfFDE.cpp ├── PLCrashAsyncDwarfFDE.hpp ├── PLCrashAsyncDwarfPrimitives.cpp ├── PLCrashAsyncDwarfPrimitives.hpp ├── PLCrashAsyncImageList.cpp ├── PLCrashAsyncImageList.h ├── PLCrashAsyncLinkedList.hpp ├── PLCrashAsyncMObject.c ├── PLCrashAsyncMObject.h ├── PLCrashAsyncMachExceptionInfo.c ├── PLCrashAsyncMachExceptionInfo.h ├── PLCrashAsyncMachOImage.c ├── PLCrashAsyncMachOImage.h ├── PLCrashAsyncMachOString.c ├── PLCrashAsyncMachOString.h ├── PLCrashAsyncObjCSection.h ├── PLCrashAsyncObjCSection.mm ├── PLCrashAsyncSignalInfo.c ├── PLCrashAsyncSignalInfo.h ├── PLCrashAsyncSymbolication.c ├── PLCrashAsyncSymbolication.h ├── PLCrashAsyncThread.c ├── PLCrashAsyncThread.h ├── PLCrashAsyncThread_arm.c ├── PLCrashAsyncThread_arm.h ├── PLCrashAsyncThread_current.S ├── PLCrashAsyncThread_current.c ├── PLCrashAsyncThread_current_defs.h ├── PLCrashAsyncThread_x86.c ├── PLCrashAsyncThread_x86.h ├── PLCrashCompatConstants.h ├── PLCrashFeatureConfig.h ├── PLCrashFrameCompactUnwind.c ├── PLCrashFrameCompactUnwind.h ├── PLCrashFrameDWARFUnwind.cpp ├── PLCrashFrameDWARFUnwind.h ├── PLCrashFrameStackUnwind.c ├── PLCrashFrameStackUnwind.h ├── PLCrashFrameWalker.c ├── PLCrashFrameWalker.h ├── PLCrashHostInfo.h ├── PLCrashHostInfo.m ├── PLCrashLogWriter.h ├── PLCrashLogWriter.m ├── PLCrashLogWriterEncoding.c ├── PLCrashLogWriterEncoding.h ├── PLCrashMachExceptionPort.h ├── PLCrashMachExceptionPort.m ├── PLCrashMachExceptionPortSet.h ├── PLCrashMachExceptionPortSet.m ├── PLCrashMachExceptionServer.h ├── PLCrashMachExceptionServer.m ├── PLCrashMacros.h ├── PLCrashNamespace.h ├── PLCrashProcessInfo.h ├── PLCrashProcessInfo.m ├── PLCrashReport.h ├── PLCrashReport.m ├── PLCrashReport.pb-c.c ├── PLCrashReport.pb-c.h ├── PLCrashReport.proto ├── PLCrashReportApplicationInfo.h ├── PLCrashReportApplicationInfo.m ├── PLCrashReportBinaryImageInfo.h ├── PLCrashReportBinaryImageInfo.m ├── PLCrashReportExceptionInfo.h ├── PLCrashReportExceptionInfo.m ├── PLCrashReportFormatter.h ├── PLCrashReportMachExceptionInfo.h ├── PLCrashReportMachExceptionInfo.m ├── PLCrashReportMachineInfo.h ├── PLCrashReportMachineInfo.m ├── PLCrashReportProcessInfo.h ├── PLCrashReportProcessInfo.m ├── PLCrashReportProcessorInfo.h ├── PLCrashReportProcessorInfo.m ├── PLCrashReportRegisterInfo.h ├── PLCrashReportRegisterInfo.m ├── PLCrashReportSignalInfo.h ├── PLCrashReportSignalInfo.m ├── PLCrashReportStackFrameInfo.h ├── PLCrashReportStackFrameInfo.m ├── PLCrashReportSymbolInfo.h ├── PLCrashReportSymbolInfo.m ├── PLCrashReportSystemInfo.h ├── PLCrashReportSystemInfo.m ├── PLCrashReportTextFormatter.h ├── PLCrashReportTextFormatter.m ├── PLCrashReportThreadInfo.h ├── PLCrashReportThreadInfo.m ├── PLCrashReporter.h ├── PLCrashReporter.m ├── PLCrashReporterConfig.h ├── PLCrashReporterConfig.m ├── PLCrashReporterNSError.h ├── PLCrashReporterNSError.m ├── PLCrashSignalHandler.h ├── PLCrashSignalHandler.mm ├── PLCrashSysctl.c ├── PLCrashSysctl.h ├── PLCrashUncaughtExceptionHandler.h ├── PLCrashUncaughtExceptionHandler.m ├── dwarf_opstream.cpp ├── dwarf_opstream.hpp ├── dwarf_private.h └── dwarf_stack.hpp ├── Tests ├── Libunwind Regression Tests │ ├── README.txt │ ├── unwind_test_arm.S │ ├── unwind_test_arm64.S │ ├── unwind_test_arm64_frame.S │ ├── unwind_test_arm64_frameless.S │ ├── unwind_test_harness.c │ ├── unwind_test_harness.h │ ├── unwind_test_x86.S │ ├── unwind_test_x86_64.S │ ├── unwind_test_x86_64_disable_compact_frame.S │ ├── unwind_test_x86_64_frame.S │ ├── unwind_test_x86_64_frameless.S │ ├── unwind_test_x86_64_frameless_big.S │ ├── unwind_test_x86_64_unusual.S │ ├── unwind_test_x86_disable_compact_frame.S │ ├── unwind_test_x86_frame.S │ ├── unwind_test_x86_frameless.S │ ├── unwind_test_x86_frameless_big.S │ └── unwind_test_x86_unusual.S ├── PLCrashAsyncCompactUnwindEncodingTests.m ├── PLCrashAsyncDwarfCFAStateEvaluationTests.mm ├── PLCrashAsyncDwarfCFAStateTests.mm ├── PLCrashAsyncDwarfCIETests.mm ├── PLCrashAsyncDwarfEncodingTests.mm ├── PLCrashAsyncDwarfExpressionTests.mm ├── PLCrashAsyncDwarfFDETests.mm ├── PLCrashAsyncDwarfPrimitivesTests.mm ├── PLCrashAsyncImageListTests.m ├── PLCrashAsyncLinkedListTests.mm ├── PLCrashAsyncMObjectTests.m ├── PLCrashAsyncMachExceptionInfoTests.m ├── PLCrashAsyncMachOImageTests.m ├── PLCrashAsyncMachOStringTests.m ├── PLCrashAsyncObjCSectionTests.m ├── PLCrashAsyncSignalInfoTests.m ├── PLCrashAsyncSymbolicationTests.m ├── PLCrashAsyncTests.m ├── PLCrashAsyncThreadTests.m ├── PLCrashFrameCompactUnwindTests.m ├── PLCrashFrameDWARFUnwindTests.m ├── PLCrashFrameStackUnwindTests.m ├── PLCrashFrameWalkerTests.m ├── PLCrashHostInfoTests.m ├── PLCrashLogWriterEncodingTests.m ├── PLCrashLogWriterEncodingTests.pb-c.c ├── PLCrashLogWriterEncodingTests.pb-c.h ├── PLCrashLogWriterEncodingTests.proto ├── PLCrashLogWriterTests.m ├── PLCrashMachExceptionPortSetTests.m ├── PLCrashMachExceptionPortTests.m ├── PLCrashMachExceptionServerTests.m ├── PLCrashProcessInfoTests.m ├── PLCrashReportTests.m ├── PLCrashReporterNSErrorTests.m ├── PLCrashReporterTests.m ├── PLCrashSignalHandlerTests.m ├── PLCrashSysctlTests.m ├── PLCrashTestCase.h ├── PLCrashTestCase.m ├── PLCrashTestThread.h ├── PLCrashTestThread.m ├── PLCrashTestThreadTests.m ├── PLCrashUncaughtExceptionHandlerTests.m ├── SenTestCompat.h ├── dwarf_encoding_test.h ├── dwarf_opstream_tests.mm └── dwarf_stack_tests.mm ├── ThirdPartyNotices.txt ├── Tools └── CrashViewer │ ├── CrashReporterQuicklook │ ├── CrashReporterQuicklook-Info.plist │ ├── CrashReporterQuicklook-Prefix.pch │ ├── GeneratePreviewForURL.m │ ├── GenerateThumbnailForURL.c │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.c │ ├── CrashViewer.xcodeproj │ └── project.pbxproj │ └── CrashViewer │ ├── CrashViewer-Info.plist │ ├── CrashViewer-Prefix.pch │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── PLAsyncTask.h │ ├── PLAsyncTask.m │ ├── PLCrashDocument.h │ ├── PLCrashDocument.m │ ├── PLCrashWindowController.h │ ├── PLCrashWindowController.m │ ├── PLProgressIndicatorController.h │ ├── PLProgressIndicatorController.m │ ├── PLProgressIndicatorController.xib │ ├── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ ├── MainMenu.xib │ └── PLCrashWindow.xib │ └── main.m └── include ├── CrashReporter.h ├── PLCrashFeatureConfig.h ├── PLCrashMacros.h ├── PLCrashNamespace.h ├── PLCrashReport.h ├── PLCrashReportApplicationInfo.h ├── PLCrashReportBinaryImageInfo.h ├── PLCrashReportExceptionInfo.h ├── PLCrashReportFormatter.h ├── PLCrashReportMachExceptionInfo.h ├── PLCrashReportMachineInfo.h ├── PLCrashReportProcessInfo.h ├── PLCrashReportProcessorInfo.h ├── PLCrashReportRegisterInfo.h ├── PLCrashReportSignalInfo.h ├── PLCrashReportStackFrameInfo.h ├── PLCrashReportSymbolInfo.h ├── PLCrashReportSystemInfo.h ├── PLCrashReportTextFormatter.h ├── PLCrashReportThreadInfo.h ├── PLCrashReporter.h └── PLCrashReporterConfig.h /.azure-pipelines/analyze-and-test-template.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: "platforms" 3 | type: "object" 4 | 5 | stages: 6 | - stage: "analyze" 7 | dependsOn: 8 | jobs: 9 | - ${{ each platform in parameters.platforms }}: 10 | - job: 11 | displayName: "${{ format('CrashReporter {0} Analyze and Test', platform) }}" 12 | variables: 13 | XCODE_PATH: "/Applications/Xcode_14.3.1.app/Contents/Developer" 14 | templateContext: 15 | outputs: 16 | - output: "pipelineArtifact" 17 | displayName: "Publish Diagnostic Reports" 18 | condition: "failed()" 19 | targetPath: "/Users/runner/Library/Logs/DiagnosticReports" 20 | artifactName: "Test Diagnostic Reports" 21 | sbomEnabled: false 22 | 23 | steps: 24 | - checkout: "self" 25 | 26 | - task: "Xcode@5" 27 | displayName: "Analyze" 28 | inputs: 29 | actions: "analyze" 30 | configuration: "Debug" 31 | xcodeVersion: "specifyPath" 32 | xcodeDeveloperDir: "$(XCODE_PATH)" 33 | xcWorkspacePath: "CrashReporter.xcodeproj" 34 | ${{ if eq(platform, 'MacCatalyst') }}: 35 | scheme: "CrashReporter iOS" 36 | destinationPlatformOption: "macOS" 37 | ${{ if ne(platform, 'MacCatalyst') }}: 38 | scheme: "CrashReporter ${{ platform }}" 39 | destinationPlatformOption: "${{ platform }}" 40 | ${{ if eq(platform, 'iOS') }}: 41 | destinationSimulators: "iPhone 11" 42 | ${{ if eq(platform, 'tvOS') }}: 43 | destinationSimulators: "Apple TV" 44 | 45 | - task: "Xcode@5" 46 | displayName: "Test" 47 | inputs: 48 | actions: "test" 49 | configuration: "Debug" 50 | xcodeVersion: "specifyPath" 51 | xcodeDeveloperDir: "$(XCODE_PATH)" 52 | xcWorkspacePath: "CrashReporter.xcodeproj" 53 | ${{ if eq(platform, 'MacCatalyst') }}: 54 | scheme: "CrashReporter iOS" 55 | destinationPlatformOption: "macOS" 56 | ${{ if ne(platform, 'MacCatalyst') }}: 57 | scheme: "CrashReporter ${{ platform }}" 58 | destinationPlatformOption: "${{ platform }}" 59 | ${{ if eq(platform, 'iOS') }}: 60 | destinationSimulators: "iPhone 11" 61 | ${{ if eq(platform, 'tvOS') }}: 62 | destinationSimulators: "Apple TV" 63 | publishJUnitResults: true 64 | timeoutInMinutes: 10 65 | -------------------------------------------------------------------------------- /.azure-pipelines/build-plcrashreporter-1ES.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - "master" 3 | pr: 4 | - "master" 5 | 6 | variables: 7 | Configuration: "Release" 8 | SDK: "" 9 | XCODE_PATH: "/Applications/Xcode_14.3.1.app/Contents/Developer" 10 | 11 | resources: 12 | repositories: 13 | - repository: "1ESPipelineTemplates" 14 | type: "git" 15 | name: "1ESPipelineTemplates/1ESPipelineTemplates" 16 | ref: "refs/tags/release" 17 | 18 | extends: 19 | ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}: 20 | template: "v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates" 21 | ${{ else }}: 22 | template: "v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates" 23 | parameters: 24 | pool: 25 | name: "Azure Pipelines" 26 | image: "macos-13" 27 | os: "macOS" 28 | customBuildTags: 29 | - "ES365AIMigrationTooling-BulkMigrated" 30 | sdl: 31 | sourceAnalysisPool: "1ES-PT-Windows-2022" 32 | stages: 33 | - template: "./build-template.yml@self" 34 | - template: "./analyze-and-test-template.yml@self" 35 | parameters: 36 | platforms: [iOS, macOS, tvOS, MacCatalyst] 37 | - template: "./cocoapods-verification-template.yml@self" 38 | 39 | - stage: "APIScan" 40 | dependsOn: "build" 41 | pool: 42 | name: "1ES-PT-Windows-2022" 43 | os: "windows" 44 | variables: 45 | "agent.source.skip": true 46 | jobs: 47 | - job: "APIScan" 48 | steps: 49 | - task: "DownloadPipelineArtifact@2" 50 | displayName: "Download Pipeline Artifacts for APIScan" 51 | inputs: 52 | artifactName: "Release" 53 | targetPath: "$(Agent.BuildDirectory)/Release" 54 | - task: "AzureKeyVault@2" 55 | inputs: 56 | azureSubscription: "AC - Dev Infra & Build Pool" 57 | KeyVaultName: "mobile-center-sdk" 58 | SecretsFilter: "appcenter-sdk-managed-identity-clientid" 59 | RunAsPreJob: false 60 | 61 | - task: "APIScan@2" 62 | displayName: "Run APIScan" 63 | inputs: 64 | softwareFolder: "$(Agent.BuildDirectory)/Release" 65 | softwareName: "plcrashreporter" 66 | softwareVersionNum: "$(Build.BuildId)" 67 | isLargeApp: false 68 | toolVersion: "Latest" 69 | verbosityLevel: "verbose" 70 | condition: "and(succeeded(), ne(variables['DisableAPIScan'], 'true'))" 71 | env: 72 | AzureServicesAuthConnectionString: "runAs=App;AppId=$(appcenter-sdk-managed-identity-clientid)" 73 | -------------------------------------------------------------------------------- /.azure-pipelines/cocoapods-verification-template.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - stage: "cocoapods_verification" 3 | displayName: "CocoaPods Verification" 4 | dependsOn: "build" 5 | jobs: 6 | - job: "lint" 7 | displayName: "CocoaPods Lint Check" 8 | variables: 9 | XCODE_VERSION: "14.3.1" 10 | steps: 11 | - checkout: "none" 12 | 13 | - task: "Bash@3" 14 | displayName: "Switch Xcode to ${XCODE_PATH}" 15 | inputs: 16 | targetType: "inline" 17 | script: | 18 | sudo xcode-select --switch ${XCODE_PATH} 19 | 20 | - task: "DownloadPipelineArtifact@2" 21 | displayName: "Download 'Info' Pipeline Artifact" 22 | inputs: 23 | artifactName: "Info" 24 | targetPath: "$(Agent.BuildDirectory)/Info" 25 | 26 | - task: "DownloadPipelineArtifact@2" 27 | displayName: "Download 'Release' Pipeline Artifact" 28 | inputs: 29 | artifactName: "Release" 30 | targetPath: "$(Agent.BuildDirectory)/Release" 31 | 32 | - task: "Bash@3" 33 | displayName: "Rename XCFramework Zip" 34 | inputs: 35 | targetType: "inline" 36 | script: | 37 | ZIP_NAME=$(find $(Agent.BuildDirectory)/Release -type f -name "PLCrashReporter-Static-*.xcframework.zip") 38 | mv $ZIP_NAME $(Agent.BuildDirectory)/Release/PLCrashReporter-Static.xcframework.zip 39 | 40 | - task: "Bash@3" 41 | displayName: "Patch Podspec to use local zip with PLCrashReporter" 42 | inputs: 43 | targetType: "inline" 44 | script: | 45 | ZIP_NAME=$(find $(Agent.BuildDirectory)/Release -type f -name "PLCrashReporter-Static-*.xcframework.zip") 46 | sed -i '' 's|:http *=> "https://github.com/microsoft/plcrashreporter/releases/download/#{spec.version}/PLCrashReporter-Static-#{spec.version}.xcframework.zip"|:http => "file:$(Agent.BuildDirectory)/Release/PLCrashReporter-Static.xcframework.zip"|' $(Agent.BuildDirectory)/Info/PLCrashReporter.podspec 47 | 48 | - task: "Bash@3" 49 | displayName: "CocoaPods Spec Lint Check" 50 | inputs: 51 | targetType: "inline" 52 | script: | 53 | pod spec lint $(Agent.BuildDirectory)/Info/PLCrashReporter.podspec --verbose 54 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @microsoft/appcenter-fte 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for the SDK 4 | title: '' 5 | labels: feature request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/problem_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Problem report 3 | about: Report a problem using the SDK 4 | title: '' 5 | labels: support 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### **Description** 11 | 12 | Please describe the issue you are facing using the SDK. 13 | 14 | ### **Repro Steps** 15 | 16 | Please list the steps used to reproduce your issue. 17 | 18 | 1. 19 | 2. 20 | 21 | ### **Details** 22 | 23 | 1. Which SDK version are you using? 24 | 2. Which OS version did you experience the issue on? 25 | 3. Which CocoaPods/Carthage/Xcode version are you using? 26 | 4. What device version did you see this error on? Were you using an emulator or a physical device? 27 | 5. What language are you using? 28 | - [ ] Objective C 29 | - [ ] Swift 30 | 6. What third party libraries are you using? 31 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | Things to consider before you submit the PR: 9 | 10 | * [ ] Has `CHANGELOG.md` been updated? 11 | * [ ] Are tests passing locally? 12 | * [ ] Are the files formatted correctly? 13 | * [ ] Did you add unit tests? 14 | * [ ] Did you test your change with the sample apps? 15 | 16 | ## Description 17 | 18 | A few sentences describing the overall goals of the pull request. 19 | 20 | ## Related PRs or issues 21 | 22 | List related PRs and other issues. 23 | 24 | ## Misc 25 | 26 | Add what's missing, notes on what you tested, additional thoughts or questions. 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # App Code 2 | **/.idea/ 3 | **/.idea/** 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | Documentation/API/ 9 | 10 | ## Various settings 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata/ 20 | 21 | ## Other 22 | /debug.txt 23 | *.moved-aside 24 | *.xccheckout 25 | *.xcscmblueprint 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # Mac 34 | .DS_Store 35 | -------------------------------------------------------------------------------- /CrashReporter.xcodeproj/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/CrashReporter.xcodeproj/TemplateIcon.icns -------------------------------------------------------------------------------- /CrashReporter.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CrashReporter.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /CrashReporter.xcodeproj/xcshareddata/xcschemes/CrashReporter XCFramework.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /CrashReporter.xcodeproj/xcshareddata/xcschemes/CrashReporter macOS Static Framework.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /CrashReporter.xcodeproj/xcshareddata/xcschemes/CrashReporter.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Dependencies/cgmanifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/component-detection-manifest.json", 3 | "Registrations": [ 4 | { 5 | "component": { 6 | "type": "git", 7 | "git": { 8 | "name": "protobuf-c", 9 | "repositoryUrl": "https://github.com/protobuf-c/protobuf-c.git", 10 | "commitHash": "f224ab2eeb648a818eb20687d7150a285442c907" 11 | } 12 | } 13 | } 14 | ], 15 | "Version": 1 16 | } 17 | -------------------------------------------------------------------------------- /Dependencies/protobuf-c/generate-pb-c.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd "$(dirname "$0")/../../Source/" && protoc-c --c_out=. "PLCrashReport.proto" && cd "../Tests/" && protoc-c --c_out=. "PLCrashLogWriterEncodingTests.proto" -------------------------------------------------------------------------------- /Documentation/Crash Log Format/PLCrashReportFormat.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt]{article} 2 | \usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots. 3 | \geometry{letterpaper} % ... or a4paper or a5paper or ... 4 | %\geometry{landscape} % Activate for for rotated page geometry 5 | %\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent 6 | \usepackage{graphicx} 7 | \usepackage{amssymb} 8 | \usepackage{epstopdf} 9 | \usepackage[retainorgcmds]{IEEEtrantools} % So we can use IEEE's handy LaTeX tools 10 | 11 | \usepackage{color} 12 | \definecolor{SubtleURL}{cmyk}{1,0,0,1} 13 | 14 | \usepackage[pdftitle={Landon Fuller}, 15 | pdfauthor={Plausible Labs Cooperative, Inc.}, 16 | pdfsubject={Plausible Crash Log Format}, 17 | pdfkeywords={}, 18 | colorlinks=true, 19 | linkcolor=SubtleURL, 20 | citecolor=SubtleURL]{hyperref} 21 | \DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png} 22 | 23 | \title{Crash Log Format (DRAFT)} 24 | \author{Plausible Labs Cooperative, Inc.} 25 | %\date{} % Activate to display a given date or no date 26 | 27 | % Terms 28 | \newcommand{\term}{\emph} 29 | 30 | % Spacing 31 | \parskip .5em 32 | \parindent 0em 33 | 34 | \begin{document} 35 | \maketitle 36 | \tableofcontents 37 | 38 | \section{Introduction} 39 | 40 | \section{Notational Conventions} 41 | 42 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119\cite{RFC2119} 43 | 44 | \begin{thebibliography}{99} 45 | \bibitem{RFC2119} Bradner, S., ``Key words for use in RFCs to Indicate Requirement Levels'', BCP 14, RFC 2119, March 1997. 46 | \end{thebibliography} 47 | 48 | 49 | \end{document} -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Except as noted below, PLCrashReporter is provided under the 2 | following license: 3 | 4 | Copyright (c) Microsoft Corporation. 5 | Copyright (c) 2008 - 2014 Plausible Labs Cooperative, Inc. 6 | All rights reserved. 7 | 8 | Permission is hereby granted, free of charge, to any person 9 | obtaining a copy of this software and associated documentation 10 | files (the "Software"), to deal in the Software without 11 | restriction, including without limitation the rights to use, 12 | copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the 14 | Software is furnished to do so, subject to the following 15 | conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | OTHER DEALINGS IN THE SOFTWARE. 28 | 29 | Additional contributions have been made under the same license terms 30 | as above, with copyright held by their respective authors: 31 | 32 | Damian Morris 33 | Copyright (c) 2010 MOSO Corporation, Pty Ltd. 34 | All rights reserved. 35 | 36 | HockeyApp/Bitstadium 37 | Copyright (c) 2012 HockeyApp, Bit Stadium GmbH. 38 | All rights reserved. 39 | 40 | The protobuf-c library, as well as the PLCrashLogWriterEncoding.c 41 | file are licensed as follows: 42 | 43 | Copyright 2008, Dave Benson. 44 | 45 | Licensed under the Apache License, Version 2.0 (the "License"); 46 | you may not use this file except in compliance with 47 | the License. You may obtain a copy of the License 48 | at http://www.apache.org/licenses/LICENSE-2.0 Unless 49 | required by applicable law or agreed to in writing, 50 | software distributed under the License is distributed on 51 | an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 52 | KIND, either express or implied. See the License for the 53 | specific language governing permissions and limitations 54 | under the License. 55 | -------------------------------------------------------------------------------- /Other Sources/Fuzz/fuzz-main.m: -------------------------------------------------------------------------------- 1 | /* 2 | * fuzz-main.c 3 | * CrashReporter 4 | * 5 | * Created by Landon Fuller on 3/6/09. 6 | * Copyright 2009 Plausible Labs Cooperative, Inc.. All rights reserved. 7 | */ 8 | 9 | #import 10 | 11 | int main (int argc, char *argv[]) { 12 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 13 | NSError *error; 14 | 15 | if (argc < 2) 16 | return 1; 17 | 18 | /* Try to open and decode a crash report passed as the second argument */ 19 | NSString *file = [NSString stringWithUTF8String: argv[1]]; 20 | NSData *data = [NSData dataWithContentsOfFile: file]; 21 | if (data == nil) { 22 | NSLog(@"Could not load crash report data from %@", file); 23 | exit(1); 24 | } 25 | 26 | PLCrashReport *report = [[PLCrashReport alloc] initWithData: data error: &error]; 27 | if (report) 28 | [report release]; 29 | 30 | [pool release]; 31 | } 32 | -------------------------------------------------------------------------------- /PLCrashReporter.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.cocoapods_version = '>= 1.10' 3 | spec.name = 'PLCrashReporter' 4 | spec.version = '1.12.0' 5 | spec.summary = 'Reliable, open-source crash reporting for iOS, macOS and tvOS.' 6 | spec.description = 'PLCrashReporter is a reliable open source library that provides an in-process live crash reporting framework for use on iOS, macOS and tvOS. The library detects crashes and generates reports to help your investigation and troubleshooting with the information of application, system, process, thread, etc. as well as stack traces.' 7 | 8 | spec.homepage = 'https://github.com/microsoft/plcrashreporter' 9 | spec.license = { :type => 'MIT', :file => 'LICENSE.txt' } 10 | spec.authors = { 'Microsoft' => 'appcentersdk@microsoft.com' } 11 | 12 | spec.source = { :http => "https://github.com/microsoft/plcrashreporter/releases/download/#{spec.version}/PLCrashReporter-Static-#{spec.version}.xcframework.zip", 13 | :flatten => true } 14 | 15 | spec.resource_bundle = { 'PLCrashReporter' => 'CrashReporter.xcframework/PrivacyInfo.xcprivacy' } 16 | 17 | spec.ios.deployment_target = '12.0' 18 | spec.osx.deployment_target = '11.5' 19 | spec.tvos.deployment_target = '12.0' 20 | spec.vendored_frameworks = "CrashReporter.xcframework" 21 | spec.libraries = 'c++' 22 | spec.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lc++' } 23 | end 24 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.3 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "PLCrashReporter", 7 | defaultLocalization: "en", 8 | platforms: [ 9 | .iOS(.v11), 10 | .macOS(.v10_10), 11 | .tvOS(.v11) 12 | ], 13 | products: [ 14 | .library(name: "CrashReporter", targets: ["CrashReporter"]) 15 | ], 16 | targets: [ 17 | .target( 18 | name: "CrashReporter", 19 | path: "", 20 | exclude: [ 21 | "Source/dwarf_opstream.hpp", 22 | "Source/dwarf_stack.hpp", 23 | "Source/PLCrashAsyncDwarfCFAState.hpp", 24 | "Source/PLCrashAsyncDwarfCIE.hpp", 25 | "Source/PLCrashAsyncDwarfEncoding.hpp", 26 | "Source/PLCrashAsyncDwarfExpression.hpp", 27 | "Source/PLCrashAsyncDwarfFDE.hpp", 28 | "Source/PLCrashAsyncDwarfPrimitives.hpp", 29 | "Source/PLCrashAsyncLinkedList.hpp", 30 | "Source/PLCrashReport.proto", 31 | "Tools/CrashViewer/", 32 | "Other Sources/Crash Demo/", 33 | "Dependencies/protobuf-c/generate-pb-c.sh", 34 | ], 35 | sources: [ 36 | "Source", 37 | "Dependencies/protobuf-c" 38 | ], 39 | resources: [.process("Resources/PrivacyInfo.xcprivacy")], 40 | cSettings: [ 41 | .define("PLCR_PRIVATE"), 42 | .define("PLCF_RELEASE_BUILD"), 43 | .define("PLCRASHREPORTER_PREFIX", to: ""), 44 | .define("SWIFT_PACKAGE"), // Should be defined by default, Xcode 11.1 workaround. 45 | .headerSearchPath("Dependencies/protobuf-c") 46 | ], 47 | linkerSettings: [ 48 | .linkedFramework("Foundation") 49 | ] 50 | ) 51 | ] 52 | ) 53 | -------------------------------------------------------------------------------- /Resources/CrashReporter.exp: -------------------------------------------------------------------------------- 1 | # CrashReporter.exp 2 | # CrashReporter 3 | # 4 | # Created by Landon Fuller on 12/5/08. 5 | # Copyright 2008-2013 Plausible Labs Cooperative, Inc. All rights reserved. 6 | 7 | # Prefix wild-cards are used to support the case where a third-party integrator 8 | # adds their own class prefix via PLCrashNamespace.h 9 | 10 | # PLCrashReporter 11 | _*PLCrashReporterException 12 | _*PLCrashReporterErrorDomain 13 | 14 | # Export all Objective-C classes; they're picked up by the runtime regardless. 15 | .objc_class_name_*PL* 16 | _OBJC_CLASS_$_*PL* 17 | 18 | # PLCrashReport 19 | _*PLCrashReportHostOperatingSystem 20 | _*PLCrashReportHostArchitecture 21 | 22 | # PLCrashSignalHandler functions. These are currently exposed to simplify unit testing, 23 | # though the entirity of the current internal set of symbols will likely be exposed as unsupported 24 | # API in a future release. 25 | _*plcrash_signal_handler 26 | _*PLCrashSignalHandlerForward 27 | 28 | # PLCrashMachExceptionServer functions. These are currently exposed to simplify unit testing, 29 | # though the entirity of the current internal set of symbols will likely be exposed as unsupported 30 | # API in a future release. 31 | _*PLCrashMachExceptionForward 32 | -------------------------------------------------------------------------------- /Resources/CrashReporter.modulemap: -------------------------------------------------------------------------------- 1 | framework module CrashReporter { 2 | umbrella header "CrashReporter.h" 3 | 4 | export * 5 | module * { export * } 6 | 7 | link framework "Foundation" 8 | } 9 | -------------------------------------------------------------------------------- /Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /Resources/DemoCrash-iOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | Demo Crash 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | APPL 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | CFBundleShortVersionString 22 | 1.0 23 | UIFileSharingEnabled 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Resources/DemoCrash-iOS.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Resources/DemoCrash-macOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | Demo Crash 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | APPL 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | CFBundleShortVersionString 22 | 1.0 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | NSMainNibFile 26 | MainMenu 27 | NSPrincipalClass 28 | NSApplication 29 | UIFileSharingEnabled 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Resources/DemoCrash-tvOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | Demo Crash 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | APPL 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1.0 21 | CFBundleShortVersionString 22 | 1.0 23 | UIFileSharingEnabled 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Resources/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 | $(CURRENT_PROJECT_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Resources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTracking 6 | 7 | NSPrivacyTrackingDomains 8 | 9 | NSPrivacyAccessedAPITypes 10 | 11 | NSPrivacyCollectedDataTypes 12 | 13 | 14 | NSPrivacyCollectedDataType 15 | NSPrivacyCollectedDataTypeCrashData 16 | NSPrivacyCollectedDataTypeLinked 17 | 18 | NSPrivacyCollectedDataTypeTracking 19 | 20 | NSPrivacyCollectedDataTypePurposes 21 | 22 | NSPrivacyCollectedDataTypePurposeAppFunctionality 23 | 24 | 25 | 26 | NSPrivacyCollectedDataType 27 | NSPrivacyCollectedDataTypeOtherDiagnosticData 28 | NSPrivacyCollectedDataTypeLinked 29 | 30 | NSPrivacyCollectedDataTypeTracking 31 | 32 | NSPrivacyCollectedDataTypePurposes 33 | 34 | NSPrivacyCollectedDataTypePurposeAppFunctionality 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Resources/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncCompactUnwindEncodingTests/Makefile: -------------------------------------------------------------------------------- 1 | DEVELOPER?= $(shell xcode-select -print-path) 2 | PLATFORMS?= $(DEVELOPER)/Platforms/ 3 | CFLAGS?= -Os -std=c99 4 | LDFLAGS?= -dynamiclib 5 | 6 | DEVICE_SDK?= iPhoneOS7.0 7 | DEVICE_PLATFORM?= $(PLATFORMS)/iPhoneOS.platform 8 | DEVICE_ROOT?= $(DEVICE_PLATFORM)/Developer/SDKs/$(DEVICE_SDK).sdk 9 | DEVICE_CC?= $(shell xcrun -sdk `echo ${DEVICE_SDK} | tr '[A-Z]' '[a-z]'` -f clang) 10 | DEVICE_CFLAGS?= -arch armv7 -arch armv7s -arch arm64 -isysroot "$(DEVICE_ROOT)" -gdwarf-2 -miphoneos-version-min=7.0 $(CFLAGS) 11 | 12 | SIM_SDK?= iPhoneSimulator6.1 13 | SIM_PLATFORM?= $(PLATFORMS)/iPhoneSimulator.platform 14 | SIM_ROOT?= $(SIM_PLATFORM)/Developer/SDKs/$(SIM_SDK).sdk 15 | SIM_CC?= $(shell xcrun -sdk `echo ${SIM_SDK} | tr '[A-Z]' '[a-z]'` -f clang) 16 | SIM_CFLAGS?= -arch i386 -isysroot "$(SIM_ROOT)" -mmacosx-version-min=10.6 -gdwarf-2 $(CFLAGS) 17 | 18 | MAC_SDK?= MacOSX10.8 19 | MAC_PLATFORM?= $(PLATFORMS)/MacOSX.platform 20 | MAC_ROOT?= $(MAC_PLATFORM)/Developer/SDKs/$(MAC_SDK).sdk 21 | MAC_CC?= $(shell xcrun -sdk `echo ${MAC_SDK} | tr '[A-Z]' '[a-z]'` -f clang) 22 | MAC_CFLAGS?= -arch x86_64 -arch i386 -isysroot "$(MAC_ROOT)" -mmacosx-version-min=10.6 -gdwarf-2 $(CFLAGS) 23 | 24 | IOS_OBJS= test-ios.o 25 | SIM_OBJS= test-sim.o 26 | MAC_OBJS= test-macosx.o 27 | 28 | PRODUCTS= $(IOS_PRODUCT) $(MAC_PRODUCT) $(SIM_PRODUCT) 29 | IOS_PRODUCT= test.ios 30 | SIM_PRODUCT= test.sim 31 | MAC_PRODUCT= test.macosx 32 | 33 | all: $(PRODUCTS) 34 | 35 | test-sim.o: test.c 36 | $(SIM_CC) $(SIM_CFLAGS) -c $< -o $@ 37 | 38 | test-ios.o: test.c 39 | $(DEVICE_CC) $(DEVICE_CFLAGS) -c $< -o $@ 40 | 41 | test-macosx.o: test.c 42 | $(MAC_CC) $(MAC_CFLAGS) -c $< -o $@ 43 | 44 | $(MAC_PRODUCT): $(MAC_OBJS) 45 | $(MAC_CC) $(LDFLAGS) $(MAC_CFLAGS) $+ -o $@ 46 | 47 | $(IOS_PRODUCT): $(IOS_OBJS) 48 | $(DEVICE_CC) $(LDFLAGS) $(DEVICE_CFLAGS) $+ -o $@ 49 | 50 | $(SIM_PRODUCT): $(SIM_OBJS) 51 | $(SIM_CC) $(LDFLAGS) $(SIM_CFLAGS) $+ -o $@ 52 | 53 | clean-objs: 54 | rm -f $(IOS_OBJS) $(MAC_OBJS) $(SIM_OBJS) 55 | 56 | clean: clean-objs 57 | rm -f $(PRODUCTS) 58 | -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncCompactUnwindEncodingTests/test.ios: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncCompactUnwindEncodingTests/test.ios -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncCompactUnwindEncodingTests/test.macosx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncCompactUnwindEncodingTests/test.macosx -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncCompactUnwindEncodingTests/test.sim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncCompactUnwindEncodingTests/test.sim -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/Makefile: -------------------------------------------------------------------------------- 1 | DEVELOPER?= $(shell xcode-select -print-path) 2 | PLATFORMS?= $(DEVELOPER)/Platforms/ 3 | CFLAGS?= -Os -std=c99 4 | LDFLAGS?= -dynamiclib 5 | 6 | DEVICE_SDK?= iPhoneOS6.1 7 | DEVICE_PLATFORM?= $(PLATFORMS)/iPhoneOS.platform 8 | DEVICE_ROOT?= $(DEVICE_PLATFORM)/Developer/SDKs/$(DEVICE_SDK).sdk 9 | DEVICE_CC?= $(shell xcrun -sdk `echo ${DEVICE_SDK} | tr '[A-Z]' '[a-z]'` -f clang) 10 | DEVICE_CFLAGS?= -arch armv7 -arch armv7s -isysroot "$(DEVICE_ROOT)" -gdwarf-2 -miphoneos-version-min=3.0 $(CFLAGS) 11 | 12 | SIM_SDK?= iPhoneSimulator6.1 13 | SIM_PLATFORM?= $(PLATFORMS)/iPhoneSimulator.platform 14 | SIM_ROOT?= $(SIM_PLATFORM)/Developer/SDKs/$(SIM_SDK).sdk 15 | SIM_CC?= $(shell xcrun -sdk `echo ${SIM_SDK} | tr '[A-Z]' '[a-z]'` -f clang) 16 | SIM_CFLAGS?= -arch i386 -isysroot "$(SIM_ROOT)" -mmacosx-version-min=10.6 -gdwarf-2 $(CFLAGS) 17 | 18 | MAC_SDK?= MacOSX10.8 19 | MAC_PLATFORM?= $(PLATFORMS)/MacOSX.platform 20 | MAC_ROOT?= $(MAC_PLATFORM)/Developer/SDKs/$(MAC_SDK).sdk 21 | MAC_CC?= $(shell xcrun -sdk `echo ${MAC_SDK} | tr '[A-Z]' '[a-z]'` -f clang) 22 | MAC_CFLAGS?= -arch x86_64 -arch i386 -isysroot "$(MAC_ROOT)" -mmacosx-version-min=10.6 -gdwarf-2 $(CFLAGS) 23 | 24 | IOS_OBJS= test-ios.o 25 | SIM_OBJS= test-sim.o 26 | MAC_OBJS= test-macosx.o 27 | 28 | PRODUCTS= $(IOS_PRODUCT) $(MAC_PRODUCT) $(SIM_PRODUCT) 29 | IOS_PRODUCT= test.ios 30 | SIM_PRODUCT= test.sim 31 | MAC_PRODUCT= test.macosx 32 | 33 | all: $(PRODUCTS) 34 | 35 | test-sim.o: test.c 36 | $(SIM_CC) $(SIM_CFLAGS) -c $< -o $@ 37 | 38 | test-ios.o: test.c 39 | $(DEVICE_CC) $(DEVICE_CFLAGS) -c $< -o $@ 40 | 41 | test-macosx.o: test.c 42 | $(MAC_CC) $(MAC_CFLAGS) -c $< -o $@ 43 | 44 | $(MAC_PRODUCT): $(MAC_OBJS) 45 | $(MAC_CC) $(LDFLAGS) $(MAC_CFLAGS) $+ -o $@ 46 | 47 | $(IOS_PRODUCT): $(IOS_OBJS) 48 | $(DEVICE_CC) $(LDFLAGS) $(DEVICE_CFLAGS) $+ -o $@ 49 | 50 | $(SIM_PRODUCT): $(SIM_OBJS) 51 | $(SIM_CC) $(LDFLAGS) $(SIM_CFLAGS) $+ -o $@ 52 | 53 | clean-objs: 54 | rm -f $(IOS_OBJS) $(MAC_OBJS) $(SIM_OBJS) 55 | 56 | clean: clean-objs 57 | rm -f $(PRODUCTS) 58 | -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/README.txt: -------------------------------------------------------------------------------- 1 | The regression test cases were extracted from Apple's libunwind-35.1, where they 2 | are used to validate Apple's compact frame and dwarf unwinding implementation. 3 | 4 | A custom build script (build-regression-tests.sh) may be used to regenerate 5 | the test binaries. 6 | 7 | The test cases themselves are licensed under libunwind's license: 8 | 9 | Copyright (c) 2008-2011 Apple Inc. All rights reserved. 10 | 11 | This file contains Original Code and/or Modifications of Original Code 12 | as defined in and that are subject to the Apple Public Source License 13 | Version 2.0 (the 'License'). You may not use this file except in 14 | compliance with the License. Please obtain a copy of the License at 15 | http://www.opensource.apple.com/apsl/ and read it before using this 16 | file. 17 | 18 | The Original Code and all software distributed under the License are 19 | distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | Please see the License for the specific language governing rights and 24 | limitations under the License. 25 | 26 | -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/build-regression-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # ----------------------------------------------------------------------- 4 | # Copyright (c) 2010-2013, Plausible Labs Cooperative, Inc. 5 | # 6 | # Author: Landon Fuller 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining 9 | # a copy of this software and associated documentation files (the 10 | # ``Software''), to deal in the Software without restriction, including 11 | # without limitation the rights to use, copy, modify, merge, publish, 12 | # distribute, sublicense, and/or sell copies of the Software, and to 13 | # permit persons to whom the Software is furnished to do so, subject to 14 | # the following conditions: 15 | # 16 | # The above copyright notice and this permission notice shall be included 17 | # in all copies or substantial portions of the Software. 18 | # 19 | # THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 20 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 | # DEALINGS IN THE SOFTWARE. 27 | # ----------------------------------------------------------------------- 28 | 29 | process() { 30 | local file=$1 31 | local opts=`echo $2` 32 | local count=$3 33 | 34 | eval cc -o regression-bins/tbin.$file.${count} ${file} ${opts} 35 | } 36 | 37 | main() { 38 | local ifs_bak=$IFS 39 | local ifs_nl=" 40 | " 41 | 42 | IFS=$ifs_nl 43 | local count="1" 44 | for opt in `grep -H "TEST-OPTIONS:" regression/*.s`; do 45 | IFS=$ifs_back 46 | local fname=`echo "${opt}" | awk -F : '{print $1}'` 47 | local opts=`echo "${opt}" | cut -d ' ' -f 3-` 48 | process "$fname" "${opts}" "${count}" 49 | IFS=$ifs_nl 50 | count=`expr $count + 1` 51 | done 52 | } 53 | 54 | main 55 | -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_disable_compact_frame.s.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_disable_compact_frame.s.1 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.2 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.3 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.4 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frame.s.5 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless.s.6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless.s.6 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless.s.7: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless.s.7 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless_big.s.8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless_big.s.8 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless_big.s.9: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_frameless_big.s.9 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_unusual.s.10: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_unusual.s.10 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_unusual.s.11: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_64_unusual.s.11 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_disable_compact_frame.s.12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_disable_compact_frame.s.12 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.13 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.14 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.15 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frame.s.16 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless.s.17: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless.s.17 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless.s.18: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless.s.18 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless_big.s.19: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless_big.s.19 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless_big.s.20: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_frameless_big.s.20 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_unusual.s.21: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_unusual.s.21 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_unusual.s.22: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression-bins/tbin.unwind_test_x86_unusual.s.22 -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression/unwind_test_main.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include "libunwind.h" 7 | 8 | extern int unwind_tester(void*); 9 | extern void* unwind_tester_list[]; 10 | 11 | int main() 12 | { 13 | // loop over all function pointers in unwind_tester_list 14 | // and call unwind_tester() on each one. If it returns 15 | // non-zero, then that test failed. 16 | void** p; 17 | for(p=unwind_tester_list; *p != NULL; ++p) { 18 | //fprintf(stderr, "unwind_tester(%p)\n", *p); 19 | if ( unwind_tester(*p) ) 20 | return 1; 21 | } 22 | return 0; 23 | } 24 | 25 | // called by test function 26 | // we unwind through the test function 27 | // and resume at caller (unwind_tester) 28 | void uwind_to_main() 29 | { 30 | unw_cursor_t cursor; 31 | unw_context_t uc; 32 | unw_word_t offset; 33 | 34 | unw_getcontext(&uc); 35 | unw_init_local(&cursor, &uc); 36 | if ( unw_step(&cursor) > 0 ) { 37 | // now in test function 38 | if ( unw_step(&cursor) > 0 ) { 39 | // now in unwind_tester 40 | unw_resume(&cursor); 41 | } 42 | } 43 | // error if we got here 44 | exit(1); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/regression/unwind_test_x86.s: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # This is a generic function to test that restoring registers during unwinding work correctly. 4 | # 5 | 6 | .text 7 | .globl _unwind_tester 8 | _unwind_tester: 9 | LFB2: 10 | pushl %ebp 11 | LCFI0: 12 | movl %esp, %ebp 13 | LCFI1: 14 | subl $56, %esp 15 | LCFI2: 16 | movl %ebx, -12(%ebp) 17 | LCFI3: 18 | movl %esi, -8(%ebp) 19 | LCFI4: 20 | movl %edi, -4(%ebp) 21 | LCFI5: 22 | # load magic values into non-volatile registers 23 | movl $0x12344321, %ebx 24 | movl $0x56788765, %esi 25 | movl $0xABCDDCBA, %edi 26 | # call test function which will invoke unwinder which "returns" here 27 | call *8(%ebp) 28 | # verify that non-volatile registers still contain magic values 29 | cmpl $0x12344321, %ebx 30 | jne L2 31 | cmpl $0x56788765, %esi 32 | jne L2 33 | cmpl $0xABCDDCBA, %edi 34 | jne L2 35 | movl $0, %eax 36 | jmp L3 37 | L2: movl $1, %eax 38 | L3: 39 | movl -12(%ebp), %ebx 40 | movl -8(%ebp), %esi 41 | movl -4(%ebp), %edi 42 | leave 43 | ret 44 | LFE2: 45 | 46 | 47 | 48 | .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 49 | EH_frame1: 50 | .set L$set$0,LECIE1-LSCIE1 51 | .long L$set$0 # Length of Common Information Entry 52 | LSCIE1: 53 | .long 0x0 # CIE Identifier Tag 54 | .byte 0x1 # CIE Version 55 | .ascii "zR\0" # CIE Augmentation 56 | .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor 57 | .byte 0x7c # sleb128 -4; CIE Data Alignment Factor 58 | .byte 0x8 # CIE RA Column 59 | .byte 0x1 # uleb128 0x1; Augmentation size 60 | .byte 0x10 # FDE Encoding (pcrel) 61 | .byte 0xc # DW_CFA_def_cfa 62 | .byte 0x5 # uleb128 0x5 63 | .byte 0x4 # uleb128 0x4 64 | .byte 0x88 # DW_CFA_offset, column 0x8 65 | .byte 0x1 # uleb128 0x1 66 | .align 2 67 | LECIE1: 68 | 69 | .globl _unwind_tester.eh 70 | _unwind_tester.eh: 71 | LSFDE1: 72 | .set L$set$1,LEFDE1-LASFDE1 73 | .long L$set$1 # FDE Length 74 | LASFDE1: 75 | .long LASFDE1-EH_frame1 # FDE CIE offset 76 | .long LFB2-. # FDE initial location 77 | .set L$set$2,LFE2-LFB2 78 | .long L$set$2 # FDE address range 79 | .byte 0x0 # uleb128 0x0; Augmentation size 80 | .byte 0x4 # DW_CFA_advance_loc4 81 | .set L$set$3,LCFI0-LFB2 82 | .long L$set$3 83 | .byte 0xe # DW_CFA_def_cfa_offset 84 | .byte 0x8 # uleb128 0x8 85 | .byte 0x84 # DW_CFA_offset, column 0x4 86 | .byte 0x2 # uleb128 0x2 87 | .byte 0x4 # DW_CFA_advance_loc4 88 | .set L$set$4,LCFI1-LCFI0 89 | .long L$set$4 90 | .byte 0xd # DW_CFA_def_cfa_register 91 | .byte 0x4 # uleb128 0x4 92 | .byte 0x4 # DW_CFA_advance_loc4 93 | .set L$set$5,LCFI5-LCFI1 94 | .long L$set$5 95 | .byte 0x87 # DW_CFA_offset, column 0x7 96 | .byte 0x3 # uleb128 0x3 97 | .byte 0x86 # DW_CFA_offset, column 0x6 98 | .byte 0x4 # uleb128 0x4 99 | .byte 0x83 # DW_CFA_offset, column 0x3 100 | .byte 0x5 # uleb128 0x5 101 | .align 2 102 | LEFDE1: 103 | 104 | 105 | -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/test.ios: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/test.ios -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/test.macosx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/test.macosx -------------------------------------------------------------------------------- /Resources/Tests/PLCrashAsyncDwarfEncodingTests/test.sim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/Tests/PLCrashAsyncDwarfEncodingTests/test.sim -------------------------------------------------------------------------------- /Resources/fuzz_report.plcrash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/plcrashreporter/8c61e5e38e9f737dd68512ed1ea5ab081244ad65/Resources/fuzz_report.plcrash -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /Scripts/build-framework.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Builds the framework for the specified target. 5 | # Usage: build-framework.sh 6 | # Note: it must be run from Xcode's build phase. 7 | 8 | # Print only target name and configuration. Mimic Xcode output to make prettify tools happy. 9 | echo "=== BUILD TARGET $1 OF PROJECT ${PROJECT_NAME} WITH CONFIGURATION ${CONFIGURATION} ===" 10 | 11 | # OBJROOT must be customized to avoid conflicts with the current process. 12 | if [ "$2" == "maccatalyst" ]; then 13 | # Mac Catalyst is a special case - "destination" parameter must be used here. 14 | env -i "PATH=$PATH" xcodebuild \ 15 | SYMROOT="${SYMROOT}" OBJROOT="${BUILT_PRODUCTS_DIR}" PROJECT_TEMP_DIR="${PROJECT_TEMP_DIR}" \ 16 | ONLY_ACTIVE_ARCH=NO \ 17 | -project "${PROJECT_NAME}.xcodeproj" -configuration "${CONFIGURATION}" \ 18 | -scheme "$1" -destination 'platform=macOS,variant=Mac Catalyst' 19 | else 20 | env -i "PATH=$PATH" xcodebuild \ 21 | SYMROOT="${SYMROOT}" OBJROOT="${BUILT_PRODUCTS_DIR}" PROJECT_TEMP_DIR="${PROJECT_TEMP_DIR}" \ 22 | ONLY_ACTIVE_ARCH=NO \ 23 | -project "${PROJECT_NAME}.xcodeproj" -configuration "${CONFIGURATION}" \ 24 | -target "$1" -sdk "$2" 25 | fi 26 | -------------------------------------------------------------------------------- /Scripts/combine-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Combines frameworks for device and simulator into universal one. 5 | # Usage: combine-frameworks.sh 6 | 7 | echo "Combining device and simulator frameworks" 8 | cp -Rv "$1" "$3" 9 | 10 | # Combining libraries. 11 | product_name=${1##*/} 12 | product_name=${product_name%.*} 13 | script_folder=$(dirname "$0") 14 | "${script_folder}"/combine-libraries.sh \ 15 | "$1/${product_name}" \ 16 | "$2/${product_name}" \ 17 | "$3/${product_name}" 18 | 19 | echo "Appending simulator platform to Info.plist" 20 | simulator_platform=$(plutil -extract CFBundleSupportedPlatforms.0 xml1 "$2/Info.plist" -o -| sed -n "s/.*\(.*\)<\/string>.*/\1/p") 21 | plutil -insert CFBundleSupportedPlatforms.1 -string $simulator_platform "$3/Info.plist" 22 | -------------------------------------------------------------------------------- /Scripts/combine-libraries.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # Combines libraries for device and simulator into universal one. 5 | # Usage: combine-libraries.sh 6 | 7 | library_archs_diff() { 8 | local device_archs=($(lipo -archs "$1")) 9 | local simulator_archs=($(lipo -archs "$2")) 10 | comm -12 <(printf '%s\n' "${device_archs[@]}" | sort) <(printf '%s\n' "${simulator_archs[@]}" | sort) 11 | } 12 | duplicate_archs=($(library_archs_diff "$1" "$2")) 13 | if [ ${#duplicate_archs[@]} -ne 0 ]; then 14 | echo "Removing duplicate architectures (${duplicate_archs[@]}) from library for simulator" 15 | lipo "$2" ${duplicate_archs[@]/#/ -remove } -output "$3" 16 | elif [ "$2" != "$3" ]; then 17 | cp "$2" "$3" 18 | fi 19 | 20 | echo "Combining device and simulator libraries" 21 | lipo "$1" "$3" -create -output "$3" 22 | 23 | # Show information of result library. 24 | lipo -info "$3" 25 | -------------------------------------------------------------------------------- /Scripts/combine-xcframework.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Remove the previous version of the xcframework. 5 | rm -rf "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.xcframework" 6 | rm -rf "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}-static.xcframework" 7 | 8 | # Combine all frameworks into xcframework. 9 | for sdk in iphoneos iphonesimulator appletvos appletvsimulator maccatalyst; do 10 | framework_path="${BUILD_DIR}/${CONFIGURATION}-${sdk}/${PRODUCT_NAME}.framework" 11 | xcframeworks+=( -framework "${framework_path}") 12 | xcframeworksStatic+=( -framework "${framework_path}") 13 | done 14 | 15 | # Add macOS with dynamic framework to CrashReporter XCFramework. 16 | framework_path="${BUILD_DIR}/${CONFIGURATION}-macosx/${PRODUCT_NAME}.framework" 17 | xcframeworks+=( -framework "${framework_path}") 18 | 19 | # Add macOS with static framework to CrashReporter Static XCFramework. 20 | framework_path="${BUILD_DIR}/${CONFIGURATION}-macosx-static/${PRODUCT_NAME}.framework" 21 | xcframeworksStatic+=( -framework "${framework_path}") 22 | 23 | xcodebuild -create-xcframework "${xcframeworks[@]}" -output "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.xcframework" 24 | xcodebuild -create-xcframework "${xcframeworksStatic[@]}" -output "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}-static.xcframework" 25 | 26 | # Copy the PrivacyInfo.xcprivacy file. 27 | echo "Copying new PrivacyInfo.xcprivacy to ${BUILT_PRODUCTS_DIR}/${PROJECT_NAME}.xcframework" 28 | cp ${SRCROOT}/Resources/PrivacyInfo.xcprivacy ${BUILT_PRODUCTS_DIR}/${PROJECT_NAME}.xcframework 29 | cp ${SRCROOT}/Resources/PrivacyInfo.xcprivacy ${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}-static.xcframework 30 | 31 | 32 | -------------------------------------------------------------------------------- /Scripts/copy-products.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Clean 5 | rm -rf "$BUILT_PRODUCTS_DIR" 6 | mkdir -p "$BUILT_PRODUCTS_DIR" 7 | 8 | # Tools 9 | mkdir -p "$BUILT_PRODUCTS_DIR/Tools" 10 | install -m 755 "$BUILD_DIR/$CONFIGURATION-macosx/plcrashutil" "$BUILT_PRODUCTS_DIR/Tools" 11 | 12 | # Universal frameworks 13 | mkdir -p "$BUILT_PRODUCTS_DIR/iOS Framework" 14 | cp -R "$BUILD_DIR/$CONFIGURATION-iphoneuniversal/$PROJECT_NAME.framework" "$BUILT_PRODUCTS_DIR/iOS Framework" 15 | 16 | mkdir -p "$BUILT_PRODUCTS_DIR/tvOS Framework" 17 | cp -R "$BUILD_DIR/$CONFIGURATION-appletvuniversal/$PROJECT_NAME.framework" "$BUILT_PRODUCTS_DIR/tvOS Framework" 18 | 19 | # Dynamic macOS framework 20 | mkdir -p "$BUILT_PRODUCTS_DIR/Mac OS X Framework" 21 | cp -R "$BUILD_DIR/$CONFIGURATION-macosx/$PROJECT_NAME.framework" "$BUILT_PRODUCTS_DIR/Mac OS X Framework" 22 | cp -R "$BUILD_DIR/$CONFIGURATION-macosx/$PROJECT_NAME.framework.dSYM" "$BUILT_PRODUCTS_DIR/Mac OS X Framework" 23 | 24 | # XCFramework 25 | cp -R "$BUILD_DIR/$CONFIGURATION-xcframework/$PROJECT_NAME.xcframework" "$BUILT_PRODUCTS_DIR" 26 | 27 | # Static XCFramework 28 | mkdir -p "$BUILT_PRODUCTS_DIR/XCFrameworkStatic" 29 | cp -R "$BUILD_DIR/$CONFIGURATION-xcframework/$PROJECT_NAME-static.xcframework" "$BUILT_PRODUCTS_DIR/XCFrameworkStatic/$PROJECT_NAME.xcframework" 30 | 31 | # Static libraries 32 | mkdir -p "$BUILT_PRODUCTS_DIR/Static/include" 33 | cp -R "$BUILD_DIR/$CONFIGURATION-macosx/$PROJECT_NAME.framework/Headers/." "$BUILT_PRODUCTS_DIR/Static/include/" 34 | cp "$BUILD_DIR/$CONFIGURATION-iphoneuniversal/lib$PROJECT_NAME.a" "$BUILT_PRODUCTS_DIR/Static/lib$PROJECT_NAME-iOS.a" 35 | cp "$BUILD_DIR/$CONFIGURATION-appletvuniversal/lib$PROJECT_NAME.a" "$BUILT_PRODUCTS_DIR/Static/lib$PROJECT_NAME-tvOS.a" 36 | cp "$BUILD_DIR/$CONFIGURATION-macosx/lib$PROJECT_NAME.a" "$BUILT_PRODUCTS_DIR/Static/lib$PROJECT_NAME-MacOSX-Static.a" 37 | -------------------------------------------------------------------------------- /Scripts/create-archive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # Creates arcive for publishing. Should be run from build results directory. 5 | # Usage: create-archive.sh 6 | 7 | PROJECT_DIR="$(dirname "$0")/.." 8 | 9 | # Create temporary directory 10 | TEMP_PRODUCT_NAME="${PRODUCT_NAME:-`echo $1 | cut -d'-' -f 1`}" 11 | TEMP_DIR=$(mktemp -d -t "$TEMP_PRODUCT_NAME") 12 | TEMP_PATH_TO_ARCH="$TEMP_DIR/$TEMP_PRODUCT_NAME" 13 | mkdir -p "$TEMP_PATH_TO_ARCH" 14 | 15 | # Copy required files 16 | cp "$PROJECT_DIR/LICENSE" "$TEMP_PATH_TO_ARCH/LICENSE.txt" 17 | cp -R "$PROJECT_DIR/Documentation" "$TEMP_PATH_TO_ARCH" 18 | (cd "$TEMP_PATH_TO_ARCH" && ln -sf "Documentation/index.html" "API Documentation.html") 19 | cp -R "${@:2}" "$TEMP_PATH_TO_ARCH" 20 | 21 | # Archive content 22 | rm -f "$TEMP_DIR/$TEMP_PRODUCT_NAME.zip" 23 | (cd "$TEMP_DIR" && zip -ryq9 "$1.zip" "$TEMP_PRODUCT_NAME") 24 | mv "$TEMP_DIR/$1.zip" . 25 | 26 | # Remove temporary directory 27 | rm -rf "$TEMP_DIR" 28 | -------------------------------------------------------------------------------- /Scripts/generate-documentation.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DOC_SUBDIR="Documentation" 4 | DOC_DEST="${BUILD_DIR}/${DOC_SUBDIR}" 5 | 6 | # Doxygen could be in /usr/local/bin (Homebrew) or /opt/local/bin (MacPorts) 7 | # and those don't seem to be in PATH 8 | export PATH=$PATH:/usr/local/bin:/opt/local/bin 9 | 10 | if [ ! -z `which doxygen` ]; then 11 | # Generate the documentation 12 | pushd "${SRCROOT}" >/dev/null || exit 1 13 | doxygen 14 | if [ $? != 0 ]; then 15 | echo "ERROR: Documentation generation failed" >/dev/stderr 16 | exit 1 17 | fi 18 | popd >/dev/null 19 | 20 | # Populate the Documentation directory 21 | rm -rf "${DOC_DEST}" 22 | mv Documentation/API "${DOC_DEST}" 23 | else 24 | echo "WARNING: Doxygen not available, skipping documentation generation" >/dev/stderr 25 | fi 26 | -------------------------------------------------------------------------------- /Scripts/verify-modifications.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Attempt to verify that the code we're building matches the source archive we're generating 4 | # We only check for local modifications; in theory, we could assert the existence of a (local, not yet pushed) release tag. 5 | if [ "${PL_ALLOW_LOCAL_MODS}" != 1 ] && [ "${CONFIGURATION}" = "Release" ]; then 6 | if [ "$(git status --porcelain | grep -v '??' | wc -l | awk '{print $1}')" != "0" ]; then 7 | echo "" >/dev/stderr 8 | echo "=== RELEASE BUILD ERROR ===" >/dev/stderr 9 | echo "Local modifications are not permitted when generating a Release build." >/dev/stderr 10 | echo "Modifications:" >/dev/stderr 11 | git status --porcelain | grep -v '??' >/dev/stderr 12 | 13 | echo "" >/dev/stderr 14 | echo "Set the PL_ALLOW_LOCAL_MODS=1 to bypass this check, or use a non-release build configuration:" >/dev/stderr 15 | echo " env PL_ALLOW_LOCAL_MODS=1 xcodebuild ..." >/dev/stderr 16 | echo "=== RELEASE BUILD ERROR ===" >/dev/stderr 17 | echo "" >/dev/stderr 18 | 19 | exit 1 20 | fi 21 | fi 22 | -------------------------------------------------------------------------------- /Source/CrashReporter.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "CrashReporter.h" 30 | 31 | /** 32 | * Generic CrashReporter Exception 33 | * @ingroup exceptions 34 | */ 35 | NSString *PLCrashReporterException = @"PLCrashReporterException"; 36 | 37 | /** Plausible Database NSError Domain 38 | * @ingroup globals */ 39 | NSString *PLCrashReporterErrorDomain = @"PLCrashReporterErrorDomain"; 40 | -------------------------------------------------------------------------------- /Source/CrashReporterFramework.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This empty file is required to correctly resolve 3 | * all build settings and dependencies in the framework targets. 4 | */ 5 | -------------------------------------------------------------------------------- /Source/PLCrashAsyncDwarfEncoding.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 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 | #ifndef PLCRASH_ASYNC_DWARF_ENCODING_H 28 | #define PLCRASH_ASYNC_DWARF_ENCODING_H 1 29 | 30 | #include "PLCrashAsync.h" 31 | #include "PLCrashAsyncImageList.h" 32 | #include "PLCrashAsyncThread.h" 33 | 34 | #include "PLCrashAsyncDwarfPrimitives.hpp" 35 | #include "PLCrashAsyncDwarfFDE.hpp" 36 | 37 | #include "PLCrashFeatureConfig.h" 38 | #include "PLCrashMacros.h" 39 | 40 | #if PLCRASH_FEATURE_UNWIND_DWARF 41 | 42 | PLCR_CPP_BEGIN_NS 43 | namespace async { 44 | 45 | /** 46 | * @internal 47 | * @ingroup plcrash_async_dwarf 48 | * @{ 49 | */ 50 | 51 | /** 52 | * @internal 53 | * 54 | * A DWARF frame reader. Performs DWARF eh_frame/debug_frame parsing from a backing memory object. 55 | */ 56 | class dwarf_frame_reader { 57 | public: 58 | plcrash_error_t init (plcrash_async_mobject_t *mobj, 59 | const plcrash_async_byteorder_t *byteorder, 60 | bool m64, 61 | bool debug_frame); 62 | 63 | plcrash_error_t find_fde (pl_vm_off_t offset, 64 | pl_vm_address_t pc, 65 | plcrash_async_dwarf_fde_info_t *fde_info); 66 | 67 | private: 68 | /** A memory object containing the DWARF data at the starting address. */ 69 | plcrash_async_mobject_t *_mobj; 70 | 71 | /** The byte order of the encoded data. */ 72 | const plcrash_async_byteorder_t *_byteorder; 73 | 74 | /** True if the target system uses 64-bit pointers, false if it uses 32-bit pointers. */ 75 | bool _m64; 76 | 77 | /** True if this is a debug_frame section */ 78 | bool _debug_frame; 79 | }; 80 | 81 | PLCR_CPP_END_NS 82 | } 83 | 84 | /* 85 | * @} 86 | */ 87 | 88 | #endif /* PLCRASH_FEATURE_UNWIND_DWARF */ 89 | #endif /* PLCRASH_ASYNC_DWARF_ENCODING_H */ 90 | -------------------------------------------------------------------------------- /Source/PLCrashAsyncMachExceptionInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PLCRASH_ASYNC_MACH_EXCEPTION_INFO_H 30 | #define PLCRASH_ASYNC_MACH_EXCEPTION_INFO_H 31 | 32 | #include "PLCrashFeatureConfig.h" 33 | #include "PLCrashMacros.h" 34 | 35 | #if PLCRASH_FEATURE_MACH_EXCEPTIONS 36 | 37 | PLCR_C_BEGIN_DECLS 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #include "PLCrashAsync.h" 44 | 45 | /** 46 | * @internal 47 | * 48 | * @defgroup plcrash_async_mach_exception_info Mach Exception Information 49 | * @ingroup plcrash_async 50 | * 51 | * Provides mapping of Mach exception types and codes to BSD signals and 52 | * string representations 53 | * 54 | * @{ 55 | */ 56 | 57 | /* 58 | * The following values are considered unsupported (and are #ifdef'd __APPLE_API_UNSTABLE in 59 | * unpublished xnu headers), but are required for interpreting EXC_SOFTWARE appropriately. 60 | * 61 | * @internal 62 | * This is exactly why operating at the Mach exception layer is generally a bad idea. 63 | */ 64 | #ifndef EXC_UNIX_BAD_SYSCALL 65 | #define EXC_UNIX_BAD_SYSCALL 0x10000 /* SIGSYS */ 66 | #endif 67 | 68 | #ifndef EXC_UNIX_BAD_PIPE 69 | #define EXC_UNIX_BAD_PIPE 0x10001 /* SIGPIPE */ 70 | #endif 71 | 72 | #ifndef EXC_UNIX_ABORT 73 | #define EXC_UNIX_ABORT 0x10002 /* SIGABRT */ 74 | #endif 75 | 76 | bool plcrash_async_mach_exception_get_siginfo (exception_type_t exception_type, mach_exception_data_t codes, mach_msg_type_number_t code_count, cpu_type_t cpu_type, siginfo_t *siginfo); 77 | 78 | /* 79 | * @} plcrash_async_mach_exception_info 80 | */ 81 | 82 | PLCR_C_END_DECLS 83 | 84 | #endif /* PLCRASH_FEATURE_MACH_EXCEPTIONS */ 85 | #endif /* PLCRASH_ASYNC_MACH_EXCEPTION_INFO_H */ 86 | -------------------------------------------------------------------------------- /Source/PLCrashAsyncMachOString.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Mike Ash 3 | * 4 | * Copyright (c) 2012-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PLCRASH_ASYNC_MACHO_STRING_H 30 | #define PLCRASH_ASYNC_MACHO_STRING_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /** 37 | * @internal 38 | * @ingroup plcrash_async_image 39 | * @{ 40 | */ 41 | 42 | #include "PLCrashAsyncMachOImage.h" 43 | #include "PLCrashAsyncMObject.h" 44 | 45 | 46 | typedef struct plcrash_async_macho_string { 47 | /** The Mach-O image the string is found in. */ 48 | plcrash_async_macho_t *image; 49 | 50 | /** The address of the start of the string. */ 51 | pl_vm_address_t address; 52 | 53 | /** The memory object for the string contents. */ 54 | plcrash_async_mobject_t mobj; 55 | 56 | /** Whether the memory object is initialized. */ 57 | bool mobjIsInitialized; 58 | 59 | /** The string's length, in bytes, not counting the terminating NUL. */ 60 | pl_vm_size_t length; 61 | } plcrash_async_macho_string_t; 62 | 63 | 64 | plcrash_error_t plcrash_async_macho_string_init (plcrash_async_macho_string_t *string, plcrash_async_macho_t *image, pl_vm_address_t address); 65 | 66 | plcrash_error_t plcrash_async_macho_string_get_length (plcrash_async_macho_string_t *string, pl_vm_size_t *outLength); 67 | 68 | plcrash_error_t plcrash_async_macho_string_get_pointer (plcrash_async_macho_string_t *string, const char **outPointer); 69 | 70 | void plcrash_async_macho_string_free (plcrash_async_macho_string_t *string); 71 | 72 | /* 73 | * @} 74 | */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* PLCRASH_ASYNC_MACHO_STRING_H */ 81 | -------------------------------------------------------------------------------- /Source/PLCrashAsyncSignalInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PLCRASH_ASYNC_SIGNAL_INFO_H 30 | #define PLCRASH_ASYNC_SIGNAL_INFO_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /** 37 | * @internal 38 | * 39 | * @defgroup plcrash_async_signal_info Signal Information 40 | * @ingroup plcrash_async 41 | * 42 | * Provides mapping of signal number and code to strings. 43 | * 44 | * @{ 45 | */ 46 | 47 | const char *plcrash_async_signal_signame (int signal); 48 | const char *plcrash_async_signal_sigcode (int signal, int si_code); 49 | 50 | /* 51 | * @} plcrash_async_signal_info 52 | */ 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* PLCRASH_ASYNC_SIGNAL_INFO_H */ 59 | -------------------------------------------------------------------------------- /Source/PLCrashAsyncThread_current_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2012-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PLCRASH_ASYNC_THREAD_CURRENT_DEFS_H 30 | #define PLCRASH_ASYNC_THREAD_CURRENT_DEFS_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #if __x86_64__ 37 | 38 | /* sizeof(struct mcontext) */ 39 | #define PL_MCONTEXT_SIZE 712 40 | 41 | #elif __i386__ 42 | 43 | /* sizeof(struct mcontext) */ 44 | #define PL_MCONTEXT_SIZE 600 45 | 46 | #elif defined(__arm64__) 47 | 48 | /* sizeof(struct mcontext64) */ 49 | #define PL_MCONTEXT_SIZE 816 50 | 51 | #elif defined(__arm__) 52 | 53 | /* sizeof(struct mcontext) */ 54 | #define PL_MCONTEXT_SIZE 340 55 | 56 | #else 57 | 58 | #error Unsupported Platform 59 | 60 | #endif 61 | 62 | #ifndef __ASSEMBLER__ 63 | plcrash_error_t plcrash_async_thread_state_current_stub (plcrash_async_thread_state_current_callback callback, 64 | void *context, 65 | pl_mcontext_t *mctx); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* PLCRASH_ASYNC_THREAD_CURRENT_DEFS_H */ 73 | -------------------------------------------------------------------------------- /Source/PLCrashFrameCompactUnwind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 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 | #ifndef PLCRASH_FRAME_COMPACTUNWIND_H 28 | #define PLCRASH_FRAME_COMPACTUNWIND_H 29 | 30 | #include "PLCrashFeatureConfig.h" 31 | #include "PLCrashFrameWalker.h" 32 | #include "PLCrashAsyncCompactUnwindEncoding.h" 33 | 34 | #if PLCRASH_FEATURE_UNWIND_DWARF 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | plframe_error_t plframe_cursor_read_compact_unwind (task_t task, 41 | plcrash_async_image_list_t *image_list, 42 | const plframe_stackframe_t *current_frame, 43 | const plframe_stackframe_t *previous_frame, 44 | plframe_stackframe_t *next_frame); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /* PLCRASH_FEATURE_UNWIND_DWARF */ 51 | #endif /* PLCRASH_FRAME_COMPACTUNWIND_H */ 52 | -------------------------------------------------------------------------------- /Source/PLCrashFrameDWARFUnwind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 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 | #ifndef PLCRASH_FRAME_DWARF_UNWIND_H 28 | #define PLCRASH_FRAME_DWARF_UNWIND_H 29 | 30 | #include "PLCrashFeatureConfig.h" 31 | #include "PLCrashFrameWalker.h" 32 | 33 | #if PLCRASH_FEATURE_UNWIND_DWARF 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | 40 | plframe_error_t plframe_cursor_read_dwarf_unwind (task_t task, 41 | plcrash_async_image_list_t *image_list, 42 | const plframe_stackframe_t *current_frame, 43 | const plframe_stackframe_t *previous_frame, 44 | plframe_stackframe_t *next_frame); 45 | 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* PLCRASH_FEATURE_UNWIND_DWARF */ 52 | #endif /* PLCRASH_FRAME_DWARF_UNWIND_H */ 53 | -------------------------------------------------------------------------------- /Source/PLCrashFrameStackUnwind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PLCRASH_FRAME_STACKUNWIND_H 30 | #define PLCRASH_FRAME_STACKUNWIND_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include "PLCrashFrameWalker.h" 37 | 38 | plframe_error_t plframe_cursor_read_frame_ptr (task_t task, 39 | plcrash_async_image_list_t *image_list, 40 | const plframe_stackframe_t *current_frame, 41 | const plframe_stackframe_t *previous_frame, 42 | plframe_stackframe_t *next_frame); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* PLCRASH_FRAME_STACKUNWIND_H */ 49 | -------------------------------------------------------------------------------- /Source/PLCrashHostInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | /** 32 | * @ingroup plcrash_host 33 | * @{ 34 | */ 35 | 36 | /** 37 | * A major.minor.revision version number. 38 | */ 39 | typedef struct PLCrashHostInfoVersion { 40 | /** The major version number. */ 41 | NSUInteger major; 42 | 43 | /** The minor version numer. */ 44 | NSUInteger minor; 45 | 46 | /** The revision number */ 47 | NSUInteger revision; 48 | } PLCrashHostInfoVersion; 49 | 50 | /** The Darwin kernel major version for Mac OS X 10.9 */ 51 | #define PLCRASH_HOST_MAC_OS_X_DARWIN_MAJOR_VERSION_10_9 13 52 | 53 | /** The Darwin kernel major version for iOS 9 */ 54 | #define PLCRASH_HOST_IOS_DARWIN_MAJOR_VERSION_9 15 55 | 56 | @interface PLCrashHostInfo : NSObject 57 | 58 | + (instancetype) currentHostInfo; 59 | 60 | /** 61 | * The Darwin (xnu) release version (eg, kern.osversion). This value is parsed from its string representation, 62 | * and may not be accurate. Clients should fail safely in the case of encountering an unexpected version value. 63 | */ 64 | @property(nonatomic, readonly) PLCrashHostInfoVersion darwinVersion; 65 | 66 | @end 67 | 68 | /** 69 | * @} 70 | */ 71 | -------------------------------------------------------------------------------- /Source/PLCrashLogWriterEncoding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008, Dave Benson. 3 | * Copyright 2008 - 2009 Plausible Labs Cooperative, Inc. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License 8 | * at http://www.apache.org/licenses/LICENSE-2.0 Unless 9 | * required by applicable law or agreed to in writing, 10 | * software distributed under the License is distributed on 11 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 12 | * KIND, either express or implied. See the License for the 13 | * specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | #ifndef PLCRASH_LOG_WRITER_ENCODING_H 18 | #define PLCRASH_LOG_WRITER_ENCODING_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #include "PLCrashAsync.h" 25 | 26 | typedef enum { 27 | PLPROTOBUF_C_TYPE_INT32, 28 | PLPROTOBUF_C_TYPE_SINT32, 29 | PLPROTOBUF_C_TYPE_SFIXED32, 30 | PLPROTOBUF_C_TYPE_INT64, 31 | PLPROTOBUF_C_TYPE_SINT64, 32 | PLPROTOBUF_C_TYPE_SFIXED64, 33 | PLPROTOBUF_C_TYPE_UINT32, 34 | PLPROTOBUF_C_TYPE_FIXED32, 35 | PLPROTOBUF_C_TYPE_UINT64, 36 | PLPROTOBUF_C_TYPE_FIXED64, 37 | PLPROTOBUF_C_TYPE_FLOAT, 38 | PLPROTOBUF_C_TYPE_DOUBLE, 39 | PLPROTOBUF_C_TYPE_BOOL, 40 | PLPROTOBUF_C_TYPE_ENUM, 41 | PLPROTOBUF_C_TYPE_STRING, 42 | PLPROTOBUF_C_TYPE_BYTES, 43 | //PLPROTOBUF_C_TYPE_GROUP, // NOT SUPPORTED 44 | PLPROTOBUF_C_TYPE_MESSAGE, 45 | } PLProtobufCType; 46 | 47 | typedef struct PLProtobufCBinaryData { 48 | size_t len; 49 | void *data; 50 | } PLProtobufCBinaryData; 51 | 52 | size_t plcrash_writer_pack (plcrash_async_file_t *file, uint32_t field_id, PLProtobufCType field_type, const void *value); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* PLCRASH_LOG_WRITER_ENCODING_H */ 59 | -------------------------------------------------------------------------------- /Source/PLCrashMachExceptionPort.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2012-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | #import 31 | 32 | #import "PLCrashFeatureConfig.h" 33 | #import "PLCrashMachExceptionPortSet.h" 34 | 35 | #if PLCRASH_FEATURE_MACH_EXCEPTIONS 36 | 37 | @interface PLCrashMachExceptionPort : NSObject 38 | 39 | - (instancetype) initWithServerPort: (mach_port_t) port 40 | mask: (exception_mask_t) mask 41 | behavior: (exception_behavior_t) behavior 42 | flavor: (thread_state_flavor_t) flavor; 43 | 44 | + (PLCrashMachExceptionPortSet *) exceptionPortsForTask: (task_t) task mask: (exception_mask_t) mask error: (NSError **) outError; 45 | + (PLCrashMachExceptionPortSet *) exceptionPortsForThread: (thread_t) thread mask: (exception_mask_t) mask error: (NSError **) outError; 46 | 47 | - (BOOL) registerForTask: (task_t) task previousPortSet: (__strong PLCrashMachExceptionPortSet **) ports error: (NSError **) outError; 48 | - (BOOL) registerForThread: (thread_t) thread previousPortSet: (__strong PLCrashMachExceptionPortSet **) ports error: (NSError **) outError; 49 | 50 | /** Exception server port. */ 51 | @property(nonatomic, readonly) mach_port_t server_port; 52 | 53 | /** Exception mask. */ 54 | @property(nonatomic, readonly) exception_mask_t mask; 55 | 56 | /** Exception behavior. */ 57 | @property(nonatomic, readonly) exception_behavior_t behavior; 58 | 59 | /** Exception thread flavor. */ 60 | @property(nonatomic, readonly) thread_state_flavor_t flavor; 61 | 62 | 63 | @end 64 | 65 | #endif /* PLCRASH_FEATURE_MACH_EXCEPTIONS */ 66 | -------------------------------------------------------------------------------- /Source/PLCrashProcessInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #import 32 | #import 33 | 34 | @interface PLCrashProcessInfo : NSObject 35 | 36 | + (instancetype) currentProcessInfo; 37 | 38 | - (instancetype) initWithProcessID: (pid_t) pid; 39 | 40 | /** The process ID of the target process. */ 41 | @property(nonatomic, readonly) pid_t processID; 42 | 43 | /** The name of the target process. This value is provided as a best-effort, and may be truncated or inaccurate. May be nil. */ 44 | @property(nonatomic, readonly, strong) NSString *processName; 45 | 46 | /** The process ID of the parent of the target process. */ 47 | @property(nonatomic, readonly) pid_t parentProcessID; 48 | 49 | /** The process start time. This is the timestamp at which the process was created. */ 50 | @property(nonatomic, readonly) struct timeval startTime; 51 | 52 | /** 53 | * YES if the target process was being traced (eg, via a debugger). 54 | */ 55 | @property(nonatomic, readonly, getter = isTraced) BOOL traced; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Source/PLCrashReportApplicationInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLCrashReportApplicationInfo : NSObject 32 | 33 | - (id) initWithApplicationIdentifier: (NSString *) applicationIdentifier 34 | applicationVersion: (NSString *) applicationVersion 35 | applicationMarketingVersion: (NSString *) applicationMarketingVersion; 36 | 37 | /** 38 | * The application identifier. This is usually the application's CFBundleIdentifier value. 39 | */ 40 | @property(nonatomic, readonly, strong) NSString *applicationIdentifier; 41 | 42 | /** 43 | * The application version. This is usually the application's CFBundleVersion value. 44 | */ 45 | @property(nonatomic, readonly, strong) NSString *applicationVersion; 46 | 47 | /** 48 | * The application marketing version. This is usually the application's CFBundleShortVersionString value if available. May be nil. 49 | */ 50 | @property(nonatomic, readonly, strong) NSString *applicationMarketingVersion; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Source/PLCrashReportApplicationInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "PLCrashReportApplicationInfo.h" 30 | 31 | /** 32 | * Crash log application data. 33 | * 34 | * Provides the application identifier and version of the crashed 35 | * application. 36 | */ 37 | @implementation PLCrashReportApplicationInfo { 38 | 39 | /** Application identifier */ 40 | __strong NSString *_applicationIdentifier; 41 | 42 | /** Application version */ 43 | __strong NSString *_applicationVersion; 44 | 45 | /** Application marketing version */ 46 | __strong NSString *_applicationMarketingVersion; 47 | } 48 | 49 | /** 50 | * Initialize with the provided application identifier and version. 51 | * 52 | * @param applicationIdentifier Application identifier. This is usually the CFBundleIdentifier value. 53 | * @param applicationVersion Application version. This is usually the CFBundleVersion value. 54 | * @param applicationMarketingVersion Application marketing version. 55 | */ 56 | - (id) initWithApplicationIdentifier: (NSString *) applicationIdentifier 57 | applicationVersion: (NSString *) applicationVersion 58 | applicationMarketingVersion: (NSString *) applicationMarketingVersion 59 | { 60 | if ((self = [super init]) == nil) 61 | return nil; 62 | 63 | _applicationIdentifier = applicationIdentifier; 64 | _applicationVersion = applicationVersion; 65 | _applicationMarketingVersion = applicationMarketingVersion; 66 | 67 | return self; 68 | } 69 | 70 | @synthesize applicationIdentifier = _applicationIdentifier; 71 | @synthesize applicationVersion = _applicationVersion; 72 | @synthesize applicationMarketingVersion = _applicationMarketingVersion; 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Source/PLCrashReportBinaryImageInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #if __has_include() 32 | #import 33 | #else 34 | #import "PLCrashReportProcessorInfo.h" 35 | #endif 36 | 37 | @interface PLCrashReportBinaryImageInfo : NSObject 38 | 39 | - (id) initWithCodeType: (PLCrashReportProcessorInfo *) processorInfo 40 | baseAddress: (uint64_t) baseAddress 41 | size: (uint64_t) imageSize 42 | name: (NSString *) imageName 43 | uuid: (NSData *) uuid; 44 | 45 | /** 46 | * Image code type, or nil if unavailable. 47 | */ 48 | @property(nonatomic, readonly, strong) PLCrashReportProcessorInfo *codeType; 49 | 50 | /** 51 | * Image base address. 52 | */ 53 | @property(nonatomic, readonly) uint64_t imageBaseAddress; 54 | 55 | /** 56 | * Segment size. 57 | */ 58 | @property(nonatomic, readonly) uint64_t imageSize; 59 | 60 | /** 61 | * Image name (absolute path) 62 | */ 63 | @property(nonatomic, readonly, strong) NSString *imageName; 64 | 65 | 66 | /** 67 | * YES if this image has an associated UUID. 68 | */ 69 | @property(nonatomic, readonly) BOOL hasImageUUID; 70 | 71 | /** 72 | * 128-bit object UUID (matches Mach-O DWARF dSYM files). May be nil if unavailable. 73 | */ 74 | @property(nonatomic, readonly, strong) NSString *imageUUID; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Source/PLCrashReportExceptionInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #if __has_include() 32 | #import 33 | #else 34 | #import "PLCrashReportThreadInfo.h" 35 | #endif 36 | 37 | @interface PLCrashReportExceptionInfo : NSObject 38 | 39 | - (id) initWithExceptionName: (NSString *) name reason: (NSString *) reason; 40 | 41 | - (id) initWithExceptionName: (NSString *) name 42 | reason: (NSString *) reason 43 | stackFrames: (NSArray *) stackFrames; 44 | 45 | /** 46 | * The exception name. 47 | */ 48 | @property(nonatomic, readonly, strong) NSString *exceptionName; 49 | 50 | /** 51 | * The exception reason. 52 | */ 53 | @property(nonatomic, readonly, strong) NSString *exceptionReason; 54 | 55 | /* The exception's original call stack, as an array of PLCrashReportStackFrameInfo instances, or nil if unavailable. 56 | * This may be preserved across rethrow of an exception, and can be used to determine the original call stack. */ 57 | @property(nonatomic, readonly, strong) NSArray *stackFrames; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Source/PLCrashReportExceptionInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #if __has_include() 30 | #import 31 | #else 32 | #import "PLCrashReportExceptionInfo.h" 33 | #endif 34 | 35 | /** 36 | * If a crash is triggered by an uncaught Objective-C exception, the exception name and reason will be made available. 37 | */ 38 | @implementation PLCrashReportExceptionInfo { 39 | 40 | /** Name */ 41 | __strong NSString *_name; 42 | 43 | /** Reason */ 44 | __strong NSString *_reason; 45 | 46 | /** Ordered list of PLCrashReportStackFrame instances, or nil if unavailable. */ 47 | __strong NSArray *_stackFrames; 48 | } 49 | 50 | @synthesize exceptionName = _name; 51 | @synthesize exceptionReason = _reason; 52 | @synthesize stackFrames = _stackFrames; 53 | 54 | /** 55 | * Initialize with the given exception name and reason. 56 | * 57 | * @param name Exception name. 58 | * @param reason Exception reason. 59 | */ 60 | - (id) initWithExceptionName: (NSString *) name reason: (NSString *) reason { 61 | return [self initWithExceptionName: name reason: reason stackFrames: nil]; 62 | } 63 | 64 | /** 65 | * Initialize with the given exception name, reason, and call stack. 66 | * 67 | * @param name Exception name. 68 | * @param reason Exception reason. 69 | * @param stackFrames The exception's original call stack, as an array of PLCrashReportStackFrameInfo instances. 70 | */ 71 | - (id) initWithExceptionName: (NSString *) name reason: (NSString *) reason stackFrames: (NSArray *) stackFrames { 72 | if ((self = [super init]) == nil) 73 | return nil; 74 | 75 | _name = name; 76 | _reason = reason; 77 | _stackFrames = stackFrames; 78 | 79 | return self; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Source/PLCrashReportFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #if __has_include() 32 | #import 33 | #else 34 | #import "PLCrashReport.h" 35 | #endif 36 | 37 | /** 38 | * A crash report formatter accepts a PLCrashReport instance, formats it according to implementation-specified rules, 39 | * (such as implementing text output support), and returns the result. 40 | */ 41 | @protocol PLCrashReportFormatter 42 | 43 | /** 44 | * Format the provided @a report. 45 | * 46 | * @param report Report to be formatted. 47 | * @param outError A pointer to an NSError object variable. If an error occurs, this pointer will contain an error 48 | * object indicating why the pending crash report could not be formatted. If no error occurs, this parameter will 49 | * be left unmodified. You may specify nil for this parameter, and no error information will be provided. 50 | * 51 | * @return Returns the formatted report data on success, or nil on failure. 52 | */ 53 | - (NSData *) formatReport: (PLCrashReport *) report error: (NSError **) outError; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Source/PLCrashReportMachExceptionInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLCrashReportMachExceptionInfo : NSObject 32 | 33 | - (id) initWithType: (uint64_t) type codes: (NSArray *) codes; 34 | 35 | /** The Mach exception type. */ 36 | @property(nonatomic, readonly) uint64_t type; 37 | 38 | /** The Mach exception codes, represented as an ordered array of 64-bit unsigned NSNumber instances. */ 39 | @property(nonatomic, readonly, strong) NSArray *codes; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Source/PLCrashReportMachExceptionInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "PLCrashReportMachExceptionInfo.h" 30 | 31 | /** 32 | * Provides access to the exception type and code. @sa mach_exceptions. 33 | */ 34 | @implementation PLCrashReportMachExceptionInfo { 35 | 36 | /** The Mach exception type. */ 37 | uint64_t _type; 38 | 39 | /** The Mach exception codes, represented as an ordered array of NSNumber instances. */ 40 | __strong NSArray *_codes; 41 | } 42 | 43 | @synthesize type = _type; 44 | @synthesize codes = _codes; 45 | 46 | /** 47 | * Initialize with the given type and codes. 48 | */ 49 | - (id) initWithType: (uint64_t) type codes: (NSArray *) codes { 50 | if ((self = [super init]) == nil) 51 | return nil; 52 | 53 | _type = type; 54 | _codes = codes; 55 | 56 | return self; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Source/PLCrashReportMachineInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #if __has_include() 32 | #import 33 | #else 34 | #import "PLCrashReportProcessorInfo.h" 35 | #endif 36 | 37 | @interface PLCrashReportMachineInfo : NSObject 38 | 39 | - (id) initWithModelName: (NSString *) modelName 40 | processorInfo: (PLCrashReportProcessorInfo *) processorInfo 41 | processorCount: (NSUInteger) processorCount 42 | logicalProcessorCount: (NSUInteger) logicalProcessorCount; 43 | 44 | /** The hardware model name (eg, MacBookPro6,1). This may be unavailable, and this property will be nil. */ 45 | @property(nonatomic, readonly, strong) NSString *modelName; 46 | 47 | /** The processor type. This will be unavailable in reports generated prior to PLCrashReporter 1.2, in which case this property will be nil. */ 48 | @property(nonatomic, readonly, strong) PLCrashReportProcessorInfo *processorInfo; 49 | 50 | /* 51 | * The number of actual physical processor cores. Note that the number of active processors may be managed by the 52 | * operating system's power management system, and this value may not reflect the number of active 53 | * processors at the time of the crash. 54 | */ 55 | @property(nonatomic, readonly) NSUInteger processorCount; 56 | 57 | /* 58 | * The number of logical processors. Note that the number of active processors may be managed by the 59 | * operating system's power management system, and this value may not reflect the number of active 60 | * processors at the time of the crash. 61 | */ 62 | @property(nonatomic, readonly) NSUInteger logicalProcessorCount; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Source/PLCrashReportProcessorInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | #import 31 | 32 | /** 33 | * @ingroup constants 34 | * 35 | * The type encodings supported for CPU types and subtypes. Currently only Apple 36 | * Mach-O defined encodings are supported. 37 | * 38 | * @internal 39 | * These enum values match the protobuf values. Keep them synchronized. 40 | */ 41 | typedef enum { 42 | /** Unknown cpu type encoding. */ 43 | PLCrashReportProcessorTypeEncodingUnknown = 0, 44 | 45 | /** Apple Mach-defined processor types. */ 46 | PLCrashReportProcessorTypeEncodingMach = 1 47 | } PLCrashReportProcessorTypeEncoding; 48 | 49 | @interface PLCrashReportProcessorInfo : NSObject 50 | 51 | - (id) initWithTypeEncoding: (PLCrashReportProcessorTypeEncoding) typeEncoding 52 | type: (uint64_t) type 53 | subtype: (uint64_t) subtype; 54 | 55 | /** The CPU type encoding. */ 56 | @property(nonatomic, readonly) PLCrashReportProcessorTypeEncoding typeEncoding; 57 | 58 | /** The CPU type. */ 59 | @property(nonatomic, readonly) uint64_t type; 60 | 61 | /** The CPU subtype. */ 62 | @property(nonatomic, readonly) uint64_t subtype; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Source/PLCrashReportRegisterInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLCrashReportRegisterInfo : NSObject 32 | 33 | - (id) initWithRegisterName: (NSString *) registerName registerValue: (uint64_t) registerValue; 34 | 35 | /** 36 | * Register name. 37 | */ 38 | @property(nonatomic, readonly, strong) NSString *registerName; 39 | 40 | /** 41 | * Register value. 42 | */ 43 | @property(nonatomic, readonly) uint64_t registerValue; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Source/PLCrashReportRegisterInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | 30 | #import "PLCrashReportRegisterInfo.h" 31 | 32 | /** 33 | * Crash log general purpose register information. 34 | */ 35 | @implementation PLCrashReportRegisterInfo { 36 | 37 | /** Register name */ 38 | __strong NSString *_registerName; 39 | 40 | /** Register value */ 41 | uint64_t _registerValue; 42 | } 43 | 44 | /** 45 | * Initialize with the provided name and value. 46 | */ 47 | - (id) initWithRegisterName: (NSString *) registerName registerValue: (uint64_t) registerValue { 48 | if ((self = [super init]) == nil) 49 | return nil; 50 | 51 | _registerName = registerName; 52 | _registerValue = registerValue; 53 | 54 | return self; 55 | } 56 | 57 | @synthesize registerName = _registerName; 58 | @synthesize registerValue = _registerValue; 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Source/PLCrashReportSignalInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLCrashReportSignalInfo : NSObject 32 | 33 | - (id) initWithSignalName: (NSString *) name code: (NSString *) code address: (uint64_t) address; 34 | 35 | /** 36 | * The signal name. 37 | */ 38 | @property(nonatomic, readonly, strong) NSString *name; 39 | 40 | /** 41 | * The signal code. 42 | */ 43 | @property(nonatomic, readonly, strong) NSString *code; 44 | 45 | /** 46 | * The faulting instruction or address. 47 | */ 48 | @property(nonatomic, readonly) uint64_t address; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Source/PLCrashReportSignalInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "PLCrashReportSignalInfo.h" 30 | 31 | 32 | /** 33 | * Provides access to the signal name and signal code. 34 | */ 35 | @implementation PLCrashReportSignalInfo { 36 | 37 | /** Signal name */ 38 | __strong NSString *_name; 39 | 40 | /** Signal code */ 41 | __strong NSString *_code; 42 | 43 | /** Fauling instruction or address */ 44 | uint64_t _address; 45 | } 46 | 47 | /** 48 | * Initialize with the given signal name and reason. 49 | */ 50 | - (id) initWithSignalName: (NSString *) name code: (NSString *) code address: (uint64_t) address { 51 | if ((self = [super init]) == nil) 52 | return nil; 53 | 54 | _name = name; 55 | _code = code; 56 | _address = address; 57 | 58 | return self; 59 | } 60 | 61 | @synthesize name = _name; 62 | @synthesize code = _code; 63 | @synthesize address = _address; 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Source/PLCrashReportStackFrameInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #if __has_include() 32 | #import 33 | #else 34 | #import "PLCrashReportSymbolInfo.h" 35 | #endif 36 | 37 | @interface PLCrashReportStackFrameInfo : NSObject 38 | 39 | - (id) initWithInstructionPointer: (uint64_t) instructionPointer symbolInfo: (PLCrashReportSymbolInfo *) symbolInfo; 40 | 41 | /** 42 | * Frame's instruction pointer. 43 | */ 44 | @property(nonatomic, readonly) uint64_t instructionPointer; 45 | 46 | /** Symbol information for this frame. 47 | * This may be unavailable, and this property will be nil. */ 48 | @property(nonatomic, readonly) PLCrashReportSymbolInfo *symbolInfo; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Source/PLCrashReportStackFrameInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #if __has_include() 30 | #import 31 | #else 32 | #import "PLCrashReportStackFrameInfo.h" 33 | #endif 34 | 35 | /** 36 | * Crash log stack frame information. 37 | */ 38 | @implementation PLCrashReportStackFrameInfo { 39 | 40 | /** Frame instruction pointer. */ 41 | uint64_t _instructionPointer; 42 | 43 | /** Symbol information, if available. Otherwise, will be nil. */ 44 | __strong PLCrashReportSymbolInfo *_symbolInfo; 45 | } 46 | 47 | @synthesize instructionPointer = _instructionPointer; 48 | @synthesize symbolInfo = _symbolInfo; 49 | 50 | /** 51 | * Initialize with the provided frame info. 52 | * 53 | * @param instructionPointer The instruction pointer value for this frame. 54 | * @param symbolInfo Symbol information for this frame, if available. May be nil. 55 | */ 56 | - (id) initWithInstructionPointer: (uint64_t) instructionPointer symbolInfo: (PLCrashReportSymbolInfo *) symbolInfo { 57 | if ((self = [super init]) == nil) 58 | return nil; 59 | 60 | _instructionPointer = instructionPointer; 61 | _symbolInfo = symbolInfo; 62 | return self; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Source/PLCrashReportSymbolInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2012-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLCrashReportSymbolInfo : NSObject 32 | 33 | - (id) initWithSymbolName: (NSString *) symbolName 34 | startAddress: (uint64_t) startAddress 35 | endAddress: (uint64_t) endAddress; 36 | 37 | /** The symbol name. */ 38 | @property(nonatomic, readonly, strong) NSString *symbolName; 39 | 40 | /** The symbol start address. */ 41 | @property(nonatomic, readonly) uint64_t startAddress; 42 | 43 | /* The symbol end address, if explicitly defined. This will only be included if the end address is 44 | * explicitly defined (eg, by DWARF debugging information), will not be derived by best-guess 45 | * heuristics. 46 | * 47 | * If unknown, the address will be 0. 48 | */ 49 | @property(nonatomic, readonly) uint64_t endAddress; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Source/PLCrashReportSymbolInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2012-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "PLCrashReportSymbolInfo.h" 30 | 31 | /** 32 | * Crash log symbol information. 33 | */ 34 | @implementation PLCrashReportSymbolInfo { 35 | 36 | /** The symbol name. */ 37 | __strong NSString *_symbolName; 38 | 39 | /** The symbol start address. */ 40 | uint64_t _startAddress; 41 | 42 | /** The symbol end address, if explicitly defined. Will be 0 if unknown. */ 43 | uint64_t _endAddress; 44 | } 45 | 46 | @synthesize symbolName = _symbolName; 47 | @synthesize startAddress = _startAddress; 48 | @synthesize endAddress = _endAddress; 49 | 50 | /** 51 | * Initialize with the provided symbol info. 52 | * 53 | * @param symbolName The symbol name. 54 | * @param startAddress The symbol start address. 55 | * @param endAddress The symbol end address, if available; otherwise, 0. This must only be provided if it has been 56 | * explicitly defined by the available debugging info, and should not be derived from best-guess heuristics. 57 | */ 58 | - (id) initWithSymbolName: (NSString *) symbolName 59 | startAddress: (uint64_t) startAddress 60 | endAddress: (uint64_t) endAddress 61 | { 62 | if ((self = [super init]) == nil) 63 | return nil; 64 | 65 | _symbolName = symbolName; 66 | _startAddress = startAddress; 67 | _endAddress = endAddress; 68 | 69 | return self; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Source/PLCrashReportTextFormatter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Authors: 3 | * Landon Fuller 4 | * Damian Morris 5 | * 6 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 7 | * Copyright (c) 2010 MOSO Corporation, Pty Ltd. 8 | * All rights reserved. 9 | * 10 | * Permission is hereby granted, free of charge, to any person 11 | * obtaining a copy of this software and associated documentation 12 | * files (the "Software"), to deal in the Software without 13 | * restriction, including without limitation the rights to use, 14 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | * copies of the Software, and to permit persons to whom the 16 | * Software is furnished to do so, subject to the following 17 | * conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be 20 | * included in all copies or substantial portions of the Software. 21 | * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 24 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 27 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 29 | * OTHER DEALINGS IN THE SOFTWARE. 30 | */ 31 | 32 | 33 | #import 34 | 35 | #if __has_include() 36 | #import 37 | #else 38 | #import "PLCrashReportFormatter.h" 39 | #endif 40 | 41 | /** 42 | * Supported text output formats. 43 | * 44 | * @ingroup enums 45 | */ 46 | typedef enum { 47 | /** An iOS-compatible crash log text format. Compatible with the crash logs generated by the device and available 48 | * through iTunes Connect. */ 49 | PLCrashReportTextFormatiOS = 0 50 | } PLCrashReportTextFormat; 51 | 52 | 53 | @interface PLCrashReportTextFormatter : NSObject 54 | 55 | + (NSString *) stringValueForCrashReport: (PLCrashReport *) report withTextFormat: (PLCrashReportTextFormat) textFormat; 56 | 57 | - (id) initWithTextFormat: (PLCrashReportTextFormat) textFormat stringEncoding: (NSStringEncoding) stringEncoding; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /Source/PLCrashReportThreadInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #ifndef PLCRASH_REPORT_THREAD_INFO_H 32 | #define PLCRASH_REPORT_THREAD_INFO_H 33 | 34 | #if __has_include() 35 | #import 36 | #import 37 | #else 38 | #import "PLCrashReportStackFrameInfo.h" 39 | #import "PLCrashReportRegisterInfo.h" 40 | #endif 41 | 42 | 43 | @interface PLCrashReportThreadInfo : NSObject 44 | 45 | - (id) initWithThreadNumber: (NSInteger) threadNumber 46 | stackFrames: (NSArray *) stackFrames 47 | crashed: (BOOL) crashed 48 | registers: (NSArray *) registers; 49 | 50 | /** 51 | * Application thread number. 52 | */ 53 | @property(nonatomic, readonly) NSInteger threadNumber; 54 | 55 | /** 56 | * Thread backtrace. Provides an array of PLCrashReportStackFrameInfo instances. 57 | * The array is ordered, last callee to first. 58 | */ 59 | @property(nonatomic, readonly, strong) NSArray *stackFrames; 60 | 61 | /** 62 | * If this thread crashed, set to YES. 63 | */ 64 | @property(nonatomic, readonly) BOOL crashed; 65 | 66 | /** 67 | * State of the general purpose and related registers, as a list of 68 | * PLCrashReportRegister instances. If this thead did not crash (crashed returns NO), 69 | * this list will be empty. 70 | */ 71 | @property(nonatomic, readonly, strong) NSArray *registers; 72 | 73 | @end 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /Source/PLCrashReportThreadInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #if __has_include() 30 | #import 31 | #else 32 | #import "PLCrashReportThreadInfo.h" 33 | #endif 34 | 35 | /** 36 | * Crash log per-thread state information. 37 | * 38 | * Provides thread state information, including a backtrace and register state. 39 | */ 40 | @implementation PLCrashReportThreadInfo { 41 | 42 | /** The thread number. Should be unique within a given crash log. */ 43 | NSInteger _threadNumber; 44 | 45 | /** Ordered list of PLCrashReportStackFrame instances */ 46 | __strong NSArray *_stackFrames; 47 | 48 | /** YES if this thread crashed. */ 49 | BOOL _crashed; 50 | 51 | /** List of PLCrashReportRegister instances. Will be empty if _crashed is NO. */ 52 | __strong NSArray *_registers; 53 | } 54 | 55 | /** 56 | * Initialize the crash log thread information. 57 | */ 58 | - (id) initWithThreadNumber: (NSInteger) threadNumber 59 | stackFrames: (NSArray *) stackFrames 60 | crashed: (BOOL) crashed 61 | registers: (NSArray *) registers 62 | { 63 | if ((self = [super init]) == nil) 64 | return nil; 65 | 66 | _threadNumber = threadNumber; 67 | _stackFrames = stackFrames; 68 | _crashed = crashed; 69 | _registers = registers; 70 | 71 | return self; 72 | } 73 | 74 | @synthesize threadNumber = _threadNumber; 75 | @synthesize stackFrames = _stackFrames; 76 | @synthesize crashed = _crashed; 77 | @synthesize registers = _registers; 78 | 79 | 80 | @end 81 | 82 | -------------------------------------------------------------------------------- /Source/PLCrashReporterNSError.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | #if __has_include() 32 | #import 33 | #import 34 | #else 35 | #import "CrashReporter.h" 36 | #import "PLCrashMacros.h" 37 | #endif 38 | 39 | 40 | PLCR_EXPORT void plcrash_populate_error (NSError **error, PLCrashReporterError code, NSString *description, NSError *cause); 41 | PLCR_EXPORT void plcrash_populate_mach_error (NSError **error, kern_return_t kr, NSString *description); 42 | PLCR_EXPORT void plcrash_populate_posix_error (NSError **error, int errnoVal, NSString *description); 43 | -------------------------------------------------------------------------------- /Source/PLCrashSignalHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | #import "PLCrashMacros.h" 31 | 32 | PLCR_C_BEGIN_DECLS 33 | 34 | typedef struct PLCrashSignalHandlerCallback PLCrashSignalHandlerCallback; 35 | 36 | /** 37 | * @internal 38 | * Signal handler callback function 39 | * 40 | * @param signo The received signal. 41 | * @param info The signal info. 42 | * @param uap The signal thread context. 43 | * @param context The previously specified context for this handler. 44 | * @param next A borrowed reference to the next signal handler's callback, or NULL if this is the final registered callback. 45 | * May be used to forward the signal via PLCrashSignalHandlerForward. 46 | * 47 | * @return Return true if the signal was handled and execution should continue, false if the signal was not handled. 48 | */ 49 | typedef bool (*PLCrashSignalHandlerCallbackFunc)(int signo, siginfo_t *info, ucontext_t *uap, void *context, PLCrashSignalHandlerCallback *next); 50 | 51 | void plcrash_signal_handler (int signo, siginfo_t *info, void *uapVoid); 52 | 53 | bool PLCrashSignalHandlerForward (PLCrashSignalHandlerCallback *next, int signal, siginfo_t *info, ucontext_t *uap); 54 | 55 | @interface PLCrashSignalHandler : NSObject 56 | 57 | + (PLCrashSignalHandler *) sharedHandler; 58 | 59 | + (void) resetHandlers; 60 | 61 | - (BOOL) registerHandlerForSignal: (int) signo 62 | callback: (PLCrashSignalHandlerCallbackFunc) callback 63 | context: (void *) context 64 | error: (NSError **) outError; 65 | 66 | @end 67 | 68 | PLCR_C_END_DECLS 69 | -------------------------------------------------------------------------------- /Source/PLCrashSysctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PLCRASH_SYSCTL_H 30 | #define PLCRASH_SYSCTL_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | /** 43 | * @internal 44 | * @ingroup plcrash_host 45 | * 46 | * @{ 47 | */ 48 | 49 | char *plcrash_sysctl_string (const char *name); 50 | bool plcrash_sysctl_int (const char *name, int *result); 51 | 52 | size_t plcrash_sysctl_valid_utf8_bytes_max (const unsigned char *s, size_t maxlen); 53 | size_t plcrash_sysctl_valid_utf8_bytes (const unsigned char *s); 54 | 55 | /* 56 | * @} 57 | */ 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* PLCRASH_SYSCTL_H */ 64 | -------------------------------------------------------------------------------- /Source/PLCrashUncaughtExceptionHandler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | 30 | #import 31 | 32 | @interface PLCrashUncaughtExceptionHandler : NSObject 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Source/PLCrashUncaughtExceptionHandler.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "PLCrashUncaughtExceptionHandler.h" 30 | 31 | /*** 32 | * @internal 33 | * 34 | * Manages a process-wide Objective-C uncaught exception handlers, including pass-through 35 | * to previously registered handlers. 36 | * 37 | * @todo Unimplemented. 38 | */ 39 | @implementation PLCrashUncaughtExceptionHandler 40 | 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Source/dwarf_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 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 | #ifndef PLCRASH_ASYNC_DWARF_PRIVATE_H 28 | #define PLCRASH_ASYNC_DWARF_PRIVATE_H 1 29 | 30 | #include "PLCrashFeatureConfig.h" 31 | 32 | #if PLCRASH_FEATURE_UNWIND_DWARF 33 | 34 | /** 35 | * @internal 36 | * @ingroup plcrash_async_dwarf 37 | * @defgroup plcrash_async_dwarf_private DWARF Internal Utility Classes 38 | */ 39 | 40 | #endif /* PLCRASH_FEATURE_UNWIND_DWARF */ 41 | #endif /* PLCRASH_ASYNC_DWARF_PRIVATE_H */ -------------------------------------------------------------------------------- /Tests/Libunwind Regression Tests/README.txt: -------------------------------------------------------------------------------- 1 | These regression test cases were extracted from Apple's libunwind-35.1, where they 2 | are used to validate Apple's compact frame and dwarf unwinding implementation. 3 | 4 | The test cases themselves are licensed under libunwind's APSL license, and are only 5 | used as part of the regression tests: 6 | 7 | Copyright (c) 2008-2011 Apple Inc. All rights reserved. 8 | 9 | This file contains Original Code and/or Modifications of Original Code 10 | as defined in and that are subject to the Apple Public Source License 11 | Version 2.0 (the 'License'). You may not use this file except in 12 | compliance with the License. Please obtain a copy of the License at 13 | http://www.opensource.apple.com/apsl/ and read it before using this 14 | file. 15 | 16 | The Original Code and all software distributed under the License are 17 | distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 18 | EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 19 | INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 21 | Please see the License for the specific language governing rights and 22 | limitations under the License. -------------------------------------------------------------------------------- /Tests/Libunwind Regression Tests/unwind_test_arm.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 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 | #if defined(__arm__) 28 | 29 | .data 30 | .globl _unwind_tester_target_ip 31 | _unwind_tester_target_ip: 32 | 33 | .text 34 | .align 2 35 | .globl _unwind_tester 36 | _unwind_tester: 37 | # TODO: Unimplemented 38 | 39 | #endif /* __arm__ */ 40 | -------------------------------------------------------------------------------- /Tests/Libunwind Regression Tests/unwind_test_harness.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013 Plausible Labs Cooperative, Inc. All rights reserved. 3 | Copyright (c) 2008-2011 Apple Inc. All rights reserved. 4 | 5 | This file contains Original Code and/or Modifications of Original Code 6 | as defined in and that are subject to the Apple Public Source License 7 | Version 2.0 (the 'License'). You may not use this file except in 8 | compliance with the License. Please obtain a copy of the License at 9 | http://www.opensource.apple.com/apsl/ and read it before using this 10 | file. 11 | 12 | The Original Code and all software distributed under the License are 13 | distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 14 | EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 15 | INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 17 | Please see the License for the specific language governing rights and 18 | limitations under the License. 19 | */ 20 | 21 | 22 | #ifndef PLCRASH_UNWIND_TEST_HARNESS_H 23 | #define PLCRASH_UNWIND_TEST_HARNESS_H 24 | 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | bool unwind_test_harness (void); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif /* PLCRASH_UNWIND_TEST_HARNESS_H */ 38 | -------------------------------------------------------------------------------- /Tests/PLCrashAsyncSignalInfoTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "SenTestCompat.h" 30 | 31 | #import "PLCrashAsyncSignalInfo.h" 32 | 33 | @interface PLCrashAsyncSignalInfoTests : SenTestCase @end 34 | 35 | 36 | @implementation PLCrashAsyncSignalInfoTests 37 | 38 | - (void) testInvalidSignalMapping { 39 | STAssertNULL(plcrash_async_signal_signame(NSIG + 1), @"Invalid signal should return NULL"); 40 | } 41 | 42 | - (void) testValidSignalMapping { 43 | STAssertTrue(strcmp(plcrash_async_signal_signame(SIGSEGV), "SIGSEGV") == 0, @"Incorrect mapping performed"); 44 | } 45 | 46 | - (void) testInvalidCodeMapping { 47 | STAssertNULL(plcrash_async_signal_sigcode(SIGIOT, 42), @"Invalid signal/code should return NULL"); 48 | } 49 | 50 | - (void) testValidCodeMapping { 51 | STAssertTrue(strcmp(plcrash_async_signal_sigcode(SIGSEGV, SEGV_NOOP), "SEGV_NOOP") == 0, @"Incorrect mapping performed"); 52 | } 53 | 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Tests/PLCrashFrameCompactUnwindTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Plausible Labs Cooperative, Inc. 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 | 28 | #import "SenTestCompat.h" 29 | #import "PLCrashFrameCompactUnwind.h" 30 | #import "PLCrashFeatureConfig.h" 31 | 32 | #if PLCRASH_FEATURE_UNWIND_COMPACT 33 | 34 | /** 35 | * @internal 36 | * 37 | * This code tests compact frame unwinding. 38 | */ 39 | @interface PLCrashFrameCompactUnwindTests : SenTestCase { 40 | @private 41 | plcrash_async_image_list_t _image_list; 42 | } 43 | 44 | @end 45 | 46 | @implementation PLCrashFrameCompactUnwindTests 47 | 48 | - (void) setUp { 49 | plcrash_nasync_image_list_init(&_image_list, mach_task_self()); 50 | } 51 | 52 | - (void) tearDown { 53 | plcrash_nasync_image_list_free(&_image_list); 54 | } 55 | 56 | - (void) testMissingIP { 57 | plframe_stackframe_t frame; 58 | plframe_stackframe_t next; 59 | plframe_error_t err; 60 | 61 | plcrash_async_thread_state_clear_all_regs(&frame.thread_state); 62 | err = plframe_cursor_read_compact_unwind(mach_task_self(), &_image_list, &frame, NULL, &next); 63 | STAssertEquals(err, PLFRAME_EBADFRAME, @"Unexpected result for a frame missing a valid PC"); 64 | } 65 | 66 | - (void) testMissingImage { 67 | plframe_stackframe_t frame; 68 | plframe_stackframe_t next; 69 | plframe_error_t err; 70 | 71 | plcrash_async_thread_state_clear_all_regs(&frame.thread_state); 72 | plcrash_async_thread_state_set_reg(&frame.thread_state, PLCRASH_REG_IP, (plcrash_greg_t) NULL); 73 | 74 | err = plframe_cursor_read_compact_unwind(mach_task_self(), &_image_list, &frame, NULL, &next); 75 | STAssertEquals(err, PLFRAME_ENOTSUP, @"Unexpected result for a frame missing a valid image"); 76 | } 77 | 78 | @end 79 | 80 | #endif /* PLCRASH_FEATURE_UNWIND_COMPACT */ 81 | -------------------------------------------------------------------------------- /Tests/PLCrashLogWriterEncodingTests.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | syntax = "proto2"; 29 | message EncoderTest { 30 | enum Enum { 31 | Value1 = 1; 32 | Value2 = 2; 33 | } 34 | 35 | optional int32 int32 = 1; 36 | optional uint32 uint32 = 2; 37 | optional sint32 sint32 = 3; 38 | optional fixed32 fixed32 = 4; 39 | optional sfixed32 sfixed32 = 5; 40 | 41 | optional int64 int64 = 6; 42 | optional uint64 uint64 = 7; 43 | optional sint64 sint64 = 8; 44 | optional fixed64 fixed64 = 9; 45 | optional sfixed64 sfixed64 = 10; 46 | 47 | optional float float = 11; 48 | optional double double = 12; 49 | 50 | optional bool bool = 13; 51 | 52 | optional Enum enum = 14; 53 | 54 | optional bytes bytes = 15; 55 | 56 | optional string string = 16; 57 | } 58 | -------------------------------------------------------------------------------- /Tests/PLCrashTestCase.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2012-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | #import "SenTestCompat.h" 31 | 32 | @interface PLCrashTestCase : SenTestCase { 33 | } 34 | 35 | - (NSString *) pathForTestResource: (NSString *) resourceName; 36 | - (NSData *) dataForTestResource: (NSString *) resourceName; 37 | - (NSData *) nativeBinaryFromTestResource: (NSString *) resourceName; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Tests/PLCrashTestThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PLCRASH_ASYNC_TEST_THREAD_H 30 | #define PLCRASH_ASYNC_TEST_THREAD_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /** 37 | * @internal 38 | * @ingroup plcrash_test_thread 39 | * @{ 40 | */ 41 | 42 | #include 43 | 44 | /** 45 | * @internal 46 | * State for test threads */ 47 | typedef struct plcrash_test_thread { 48 | /** Running test thread */ 49 | pthread_t thread; 50 | 51 | /** Thread signaling lock */ 52 | pthread_mutex_t lock; 53 | 54 | /** Thread signaling (used to inform waiting callee that thread is active) */ 55 | pthread_cond_t cond; 56 | } plcrash_test_thread_t; 57 | 58 | 59 | void plcrash_test_thread_spawn (plcrash_test_thread_t *thread); 60 | void plcrash_test_thread_stop (plcrash_test_thread_t *thread); 61 | 62 | /* 63 | * @} 64 | */ 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* PLCRASH_ASYNC_TEST_THREAD_H */ 71 | -------------------------------------------------------------------------------- /Tests/PLCrashTestThreadTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2013 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "SenTestCompat.h" 30 | 31 | #import "PLCrashAsyncThread.h" 32 | #import "PLCrashTestThread.h" 33 | 34 | @interface PLCrashTestThreadTests : SenTestCase { 35 | @private 36 | } 37 | 38 | @end 39 | 40 | @implementation PLCrashTestThreadTests 41 | 42 | - (void) testExecution { 43 | plcrash_async_thread_state_t thread_state; 44 | plcrash_test_thread_t thr; 45 | 46 | plcrash_test_thread_spawn(&thr); 47 | STAssertEquals(plcrash_async_thread_state_mach_thread_init(&thread_state, pthread_mach_thread_np(thr.thread)), 48 | PLCRASH_ESUCCESS, @"Could not fetch thread state from test thread"); 49 | plcrash_test_thread_stop(&thr); 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /Tests/PLCrashUncaughtExceptionHandlerTests.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Landon Fuller 3 | * 4 | * Copyright (c) 2008-2009 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "SenTestCompat.h" 30 | 31 | #import "PLCrashSignalHandler.h" 32 | #import "PLCrashProcessInfo.h" 33 | 34 | @interface PLCrashUncaughtExceptionHandlerTests : SenTestCase { 35 | } 36 | @end 37 | 38 | @implementation PLCrashUncaughtExceptionHandlerTests 39 | @end 40 | -------------------------------------------------------------------------------- /Tests/dwarf_encoding_test.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* Constants and structures used to generate the CFI test binaries. See also: Resources/Tests/PLCrashAsyncDwarfEncodingTests */ 4 | 5 | struct __attribute__((packed)) pl_cie_data { 6 | uint8_t version; /* Must be set to 1 or 3 -- 1=eh_frame, 3=DWARF3, 4=DWARF4 */ 7 | 8 | uint8_t augmentation[7]; 9 | 10 | uint8_t code_alignment_factor; 11 | uint8_t data_alignment_factor; 12 | uint8_t return_address_register; 13 | 14 | uint8_t augmentation_data[6]; 15 | 16 | uint8_t initial_instructions[0]; 17 | }; 18 | 19 | struct __attribute__((packed)) pl_fde_data_64 { 20 | uint64_t initial_location; 21 | uint64_t address_range; 22 | uint8_t instructions[]; 23 | }; 24 | 25 | struct __attribute__((packed)) pl_fde_data_32 { 26 | uint32_t initial_location; 27 | uint32_t address_range; 28 | uint8_t instructions[]; 29 | }; 30 | 31 | 32 | /* 32-bit and 64-bit length headers */ 33 | struct pl_cfi_header_32 { 34 | uint32_t length; 35 | uint32_t cie_id; 36 | } __attribute__((packed)); 37 | 38 | struct pl_cfi_header_64 { 39 | uint32_t flag64; /* Must be set to 0xffffffff */ 40 | uint64_t length; 41 | uint64_t cie_id; 42 | } __attribute__((packed)); 43 | 44 | /* Mock entry */ 45 | typedef union pl_cfi_entry { 46 | struct { 47 | struct pl_cfi_header_64 hdr; 48 | union { 49 | struct pl_cie_data cie; 50 | struct pl_fde_data_64 fde; 51 | }; 52 | } e64; 53 | struct { 54 | struct pl_cfi_header_32 hdr; 55 | union { 56 | struct pl_cie_data cie; 57 | struct pl_fde_data_32 fde; 58 | }; 59 | } e32; 60 | } pl_cfi_entry; 61 | 62 | /* Initial length field size */ 63 | #define PL_CFI_LEN_SIZE_64 (sizeof(uint32_t) + sizeof(uint64_t)) 64 | #define PL_CFI_LEN_SIZE_32 (sizeof(uint32_t)) 65 | 66 | /* CFE lengths, minus the initial length field. */ 67 | #define PL_CFI_SIZE_64 (sizeof(pl_cfi_entry) - PL_CFI_LEN_SIZE_64) 68 | #define PL_CFI_SIZE_32 (sizeof(pl_cfi_entry) - PL_CFI_LEN_SIZE_32) 69 | 70 | /* PC values to be used when searching for FDE entries. */ 71 | #define PL_CFI_EH_FRAME_PC 0x60 72 | #define PL_CFI_EH_FRAME_PC_RANGE 0x10 73 | 74 | #define PL_CFI_DEBUG_FRAME_PC 0x30 75 | #define PL_CFI_DEBUG_FRAME_PC_RANGE 0x10 76 | -------------------------------------------------------------------------------- /ThirdPartyNotices.txt: -------------------------------------------------------------------------------- 1 | 2 | THIRD-PARTY SOFTWARE NOTICES AND INFORMATION 3 | Do Not Translate or Localize 4 | 5 | PLCrashReporter incorporates third party material from the projects listed below. 6 | 7 | 1. Protobuf-c (https://github.com/protobuf-c/protobuf-c) 8 | 9 | %% Protobuf-c NOTICES AND INFORMATION BEGIN HERE 10 | ========================================= 11 | Commit: af2120a - https://github.com/protobuf-c/protobuf-c/blob/af2120aa55ab2b68f2be95ba7085aa329ea90fb2/LICENSE 12 | 13 | Copyright (c) 2008-2016, Dave Benson and the protobuf-c authors. 14 | All rights reserved. 15 | 16 | Redistribution and use in source and binary forms, with or without 17 | modification, are permitted provided that the following conditions are 18 | met: 19 | 20 | * Redistributions of source code must retain the above copyright 21 | notice, this list of conditions and the following disclaimer. 22 | 23 | * Redistributions in binary form must reproduce the above 24 | copyright notice, this list of conditions and the following disclaimer 25 | in the documentation and/or other materials provided with the 26 | distribution. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | 40 | The code generated by the protoc-gen-c code generator and by the 41 | protoc-c compiler is owned by the owner of the input files used when 42 | generating it. This code is not standalone and requires a support 43 | library to be linked with it. This support library is covered by the 44 | above license. 45 | ========================================= 46 | END OF Protobuf-c NOTICES AND INFORMATION 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashReporterQuicklook/CrashReporterQuicklook-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDocumentTypes 8 | 9 | 10 | CFBundleTypeRole 11 | QLGenerator 12 | LSItemContentTypes 13 | 14 | org.plcrashreporter.crash 15 | 16 | 17 | 18 | CFBundleExecutable 19 | ${EXECUTABLE_NAME} 20 | CFBundleIconFile 21 | 22 | CFBundleIdentifier 23 | coop.plausible.${PRODUCT_NAME:rfc1034identifier} 24 | CFBundleInfoDictionaryVersion 25 | 6.0 26 | CFBundleName 27 | ${PRODUCT_NAME} 28 | CFBundleShortVersionString 29 | 1 30 | CFBundleVersion 31 | 1.0 32 | CFPlugInDynamicRegisterFunction 33 | 34 | CFPlugInDynamicRegistration 35 | NO 36 | CFPlugInFactories 37 | 38 | 152FFDC1-A31F-47EA-9076-0CCAFF6359A1 39 | QuickLookGeneratorPluginFactory 40 | 41 | CFPlugInTypes 42 | 43 | 5E2D9680-5022-40FA-B806-43349622E5B9 44 | 45 | 152FFDC1-A31F-47EA-9076-0CCAFF6359A1 46 | 47 | 48 | CFPlugInUnloadFunction 49 | 50 | NSHumanReadableCopyright 51 | Copyright © 2015 Plausible Labs Cooperative, Inc. All rights reserved. 52 | QLNeedsToBeRunInMainThread 53 | 54 | QLPreviewHeight 55 | 600 56 | QLPreviewWidth 57 | 800 58 | QLSupportsConcurrentRequests 59 | 60 | QLThumbnailMinimumSize 61 | 17 62 | 63 | 64 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashReporterQuicklook/CrashReporterQuicklook-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashReporterQuicklook/GeneratePreviewForURL.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #import 5 | 6 | OSStatus GeneratePreviewForURL (void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options); 7 | void CancelPreviewGeneration (void *thisInterface, QLPreviewRequestRef preview); 8 | 9 | /* ----------------------------------------------------------------------------- 10 | Generate a preview for file 11 | 12 | This function's job is to create preview for designated file 13 | ----------------------------------------------------------------------------- */ 14 | 15 | OSStatus GeneratePreviewForURL (void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options) 16 | { 17 | @autoreleasepool { 18 | NSData *data = [NSData dataWithContentsOfURL: (__bridge NSURL *)url]; 19 | if (!data) 20 | return noErr; 21 | 22 | PLCrashReport *report = [[PLCrashReport alloc] initWithData: data error: NULL]; 23 | if (!report) 24 | return noErr; 25 | 26 | NSString *text = [PLCrashReportTextFormatter stringValueForCrashReport: report 27 | withTextFormat: PLCrashReportTextFormatiOS]; 28 | NSData *utf8Data = [text dataUsingEncoding: NSUTF8StringEncoding]; 29 | QLPreviewRequestSetDataRepresentation(preview, (__bridge CFDataRef)utf8Data, kUTTypePlainText, NULL); 30 | } 31 | return noErr; 32 | } 33 | 34 | void CancelPreviewGeneration (void *thisInterface, QLPreviewRequestRef preview) 35 | { 36 | // Implement only if supported 37 | } 38 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashReporterQuicklook/GenerateThumbnailForURL.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | OSStatus GenerateThumbnailForURL (void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize); 6 | void CancelThumbnailGeneration (void *thisInterface, QLThumbnailRequestRef thumbnail); 7 | 8 | /* ----------------------------------------------------------------------------- 9 | Generate a thumbnail for file 10 | 11 | This function's job is to create thumbnail for designated file as fast as possible 12 | ----------------------------------------------------------------------------- */ 13 | 14 | OSStatus GenerateThumbnailForURL (void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize) 15 | { 16 | // To complete your generator please implement the function GenerateThumbnailForURL in GenerateThumbnailForURL.c 17 | return noErr; 18 | } 19 | 20 | void CancelThumbnailGeneration (void *thisInterface, QLThumbnailRequestRef thumbnail) 21 | { 22 | // Implement only if supported 23 | } 24 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashReporterQuicklook/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/CrashViewer-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/PLAsyncTask.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Joe Ranieri 3 | * 4 | * Copyright (c) 2015 Plausible Labs Cooperative, Inc. 5 | * Copyright (c) Xojo, Inc. 6 | * All rights reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person 9 | * obtaining a copy of this software and associated documentation 10 | * files (the "Software"), to deal in the Software without 11 | * restriction, including without limitation the rights to use, 12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the 14 | * Software is furnished to do so, subject to the following 15 | * conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be 18 | * included in all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 27 | * OTHER DEALINGS IN THE SOFTWARE. 28 | */ 29 | 30 | #import 31 | 32 | @interface PLAsyncTask : NSObject { 33 | NSTask *_task; 34 | NSMutableData *_stdinData; 35 | NSMutableData *_stdoutData; 36 | NSMutableData *_stderrData; 37 | NSUInteger _stdinPosition; 38 | void (^_completionHandler)(PLAsyncTask *, NSData *, NSData *); 39 | } 40 | 41 | @property(nonatomic, copy) NSString *launchPath; 42 | @property(nonatomic, copy) NSArray *arguments; 43 | @property(nonatomic, copy) NSDictionary *environment; 44 | @property(nonatomic, copy) NSData *stdinData; 45 | @property(nonatomic, readonly) int terminationStatus; 46 | @property(nonatomic, readonly) NSTaskTerminationReason terminationReason; 47 | 48 | - (void)terminate; 49 | - (void)launchWithCompletionHandler:(void(^)(PLAsyncTask *, NSData *, NSData *))handler; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/PLCrashDocument.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Joe Ranieri 3 | * 4 | * Copyright (c) 2015 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLCrashDocument : NSDocument 32 | @property(nonatomic, copy) NSString *reportText; 33 | @end 34 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/PLCrashDocument.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Joe Ranieri 3 | * 4 | * Copyright (c) 2015 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "PLCrashDocument.h" 30 | #import 31 | #import "PLAsyncTask.h" 32 | #import "PLCrashWindowController.h" 33 | 34 | @interface PLCrashDocument () 35 | @end 36 | 37 | @implementation PLCrashDocument 38 | 39 | - (void)makeWindowControllers 40 | { 41 | PLCrashWindowController *controller = [[PLCrashWindowController alloc] initWithWindowNibName: @"PLCrashWindow"]; 42 | controller.shouldCascadeWindows = YES; 43 | [self addWindowController: controller]; 44 | } 45 | 46 | - (BOOL) readFromData: (NSData *)data ofType: (NSString *)typeName error: (__autoreleasing NSError **)outError 47 | { 48 | if ([typeName isEqual: @"PLCrash"]) { 49 | PLCrashReport *report = [[PLCrashReport alloc] initWithData: data error: outError]; 50 | if (!report) 51 | return NO; 52 | 53 | NSString *text = [PLCrashReportTextFormatter stringValueForCrashReport: report 54 | withTextFormat: PLCrashReportTextFormatiOS]; 55 | self.reportText = text; 56 | return YES; 57 | } else if ([typeName isEqual: @"com.apple.crashreport"] || [typeName isEqual: @"public.plain-text"]) { 58 | NSString *text = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; 59 | self.reportText = text; 60 | return text != nil; 61 | } 62 | return NO; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/PLCrashWindowController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Joe Ranieri 3 | * 4 | * Copyright (c) 2015 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLCrashWindowController : NSWindowController 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/PLProgressIndicatorController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Joe Ranieri 3 | * 4 | * Copyright (c) 2015 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | @interface PLProgressIndicatorController : NSTitlebarAccessoryViewController 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/PLProgressIndicatorController.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Joe Ranieri 3 | * 4 | * Copyright (c) 2015 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import "PLProgressIndicatorController.h" 30 | 31 | @interface PLProgressIndicatorController () 32 | @property(nonatomic, weak) IBOutlet NSProgressIndicator *indicator; 33 | @end 34 | 35 | /** A titlebar accessory view controller containing a progress wheel. */ 36 | @implementation PLProgressIndicatorController 37 | 38 | - (void)viewDidAppear { 39 | [super viewDidAppear]; 40 | [self.indicator startAnimation:nil]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/PLProgressIndicatorController.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 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1344\cocoasubrtf720 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \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 | Joe Ranieri\ 10 | \ 11 | 12 | \b With special thanks to: 13 | \b0 \ 14 | Xojo, Inc.\ 15 | } -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Tools/CrashViewer/CrashViewer/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Author: Joe Ranieri 3 | * 4 | * Copyright (c) 2015 Plausible Labs Cooperative, Inc. 5 | * All rights reserved. 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #import 30 | 31 | int main(int argc, const char * argv[]) 32 | { 33 | return NSApplicationMain(argc, argv); 34 | } 35 | -------------------------------------------------------------------------------- /include/CrashReporter.h: -------------------------------------------------------------------------------- 1 | ../Source/CrashReporter.h -------------------------------------------------------------------------------- /include/PLCrashFeatureConfig.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashFeatureConfig.h -------------------------------------------------------------------------------- /include/PLCrashMacros.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashMacros.h -------------------------------------------------------------------------------- /include/PLCrashNamespace.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashNamespace.h -------------------------------------------------------------------------------- /include/PLCrashReport.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReport.h -------------------------------------------------------------------------------- /include/PLCrashReportApplicationInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportApplicationInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportBinaryImageInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportBinaryImageInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportExceptionInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportExceptionInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportFormatter.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportFormatter.h -------------------------------------------------------------------------------- /include/PLCrashReportMachExceptionInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportMachExceptionInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportMachineInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportMachineInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportProcessInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportProcessInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportProcessorInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportProcessorInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportRegisterInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportRegisterInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportSignalInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportSignalInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportStackFrameInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportStackFrameInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportSymbolInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportSymbolInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportSystemInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportSystemInfo.h -------------------------------------------------------------------------------- /include/PLCrashReportTextFormatter.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportTextFormatter.h -------------------------------------------------------------------------------- /include/PLCrashReportThreadInfo.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReportThreadInfo.h -------------------------------------------------------------------------------- /include/PLCrashReporter.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReporter.h -------------------------------------------------------------------------------- /include/PLCrashReporterConfig.h: -------------------------------------------------------------------------------- 1 | ../Source/PLCrashReporterConfig.h --------------------------------------------------------------------------------