{"id":7552,"library":"pycrashreport","title":"PyCrashReport","description":"PyCrashReport is a pure Python 3 library designed for parsing and analyzing Apple's crash reports, distilling them into a clearer view by focusing on essential debugging data. It supports user-mode and kernel-mode crash reports, providing basic metadata for other types. The library is actively maintained, with frequent minor updates and a recent major version release (v2.0.0).","status":"active","version":"2.0.0","language":"en","source_language":"en","source_url":"https://github.com/doronz88/pycrashreport","tags":["Apple crash reports","parsing","debugging","iOS","macOS","crash analysis","mobile"],"install":[{"cmd":"pip install pycrashreport","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The primary class for parsing Apple crash reports.","symbol":"CrashReport","correct":"from pycrashreport.crash_report import CrashReport"}],"quickstart":{"code":"import os\nfrom pycrashreport.crash_report import CrashReport\n\n# Simulate a crash report content (replace with actual file reading)\ncrash_report_content = \"\"\"\nIncident Identifier: 1234ABCD-ABCD-ABCD-ABCD-1234ABCDABCD\nCrashReporter Key: 0123456789abcdef0123456789abcdef01234567\nHardware Model: iPhone13,4\nProcess: MyApp [1234]\nPath: /private/var/containers/Bundle/Application/APP_UUID/MyApp.app/MyApp\nIdentifier: com.example.MyApp\nVersion: 1.0 (1)\nCode Type: ARM-64 (Native)\nParent Process: launchd [1]\nDate/Time: 2026-04-16 10:00:00.000 +0000\nOS Version: iOS 17.4 (21E236)\nReport Version: 104\n\nException Type: EXC_BAD_ACCESS (SIGSEGV)\nException Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000\nTermination Reason: Namespace SIGNAL, Code 0xb\nTerminating Process: exc handler [1234]\n\nTriggered by Thread:  0\n\nThread 0 name:  Dispatch queue: com.apple.main-thread\nThread 0 Crashed:\n0   libsystem_kernel.dylib        0x180000000 0x180000000 + 0x21c4\n1   MyApp                         0x100000000 main + 0 (main.m:16)\n2   dyld                          0x102000000 start + 0\n\nBinary Images:\n0x100000000 - 0x100003fff MyApp arm64e  <UUID> /private/var/containers/Bundle/Application/APP_UUID/MyApp.app/MyApp\n0x180000000 - 0x18001ffff libsystem_kernel.dylib arm64e  <UUID> /usr/lib/system/libsystem_kernel.dylib\n0x102000000 - 0x102033fff dyld arm64e  <UUID> /usr/lib/dyld\n\"\"\"\n\ntry:\n    # It's common to pass the raw content or a file-like object\n    # For a real file, you would use: with open('path/to/report.ips', 'r') as f: report = CrashReport(f.read())\n    report = CrashReport(crash_report_content)\n\n    print(f\"Incident Identifier: {report.incident_identifier}\")\n    print(f\"Process Name: {report.process_name}\")\n    print(f\"Process ID: {report.process_id}\")\n    print(f\"OS Version: {report.os_version}\")\n    print(f\"Exception Type: {report.exception_type}\")\n    print(f\"Crashed Thread: {report.crashed_thread_id}\")\n\n    if report.crashed_thread and report.crashed_thread.frames:\n        print(\"\\nCrashed Thread Backtrace:\")\n        for frame in report.crashed_thread.frames:\n            print(f\"  {frame.image_name} {frame.address} {frame.symbol_name if frame.symbol_name else ''}\")\n\nexcept Exception as e:\n    print(f\"Error parsing crash report: {e}\")","lang":"python","description":"Instantiate the `CrashReport` object with the content of an Apple crash report (typically an .ips file) and access its parsed attributes like incident identifier, process name, OS version, and the crashed thread's backtrace."},"warnings":[{"fix":"Review the official changelog between v1.2.8 and v2.0.0 on GitHub. Update code to align with any new API signatures or changed behaviors.","message":"The v2.0.0 release includes 'Update project standards' and a major version bump from 1.x. While specific breaking API changes aren't explicitly detailed in the release notes, users upgrading from 1.x should review the full changelog on GitHub for potential incompatibilities in API or behavior, especially for custom integrations.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Upgrade to pycrashreport v1.2.7 or later to ensure accurate parsing of integer registers. Re-parse any crash reports processed with affected versions.","message":"Versions prior to v1.2.7 contained a bug that could lead to 'double-parsing of integer registers', resulting in incorrect register values in the parsed crash reports. This could lead to misdiagnosis of crash causes.","severity":"gotcha","affected_versions":"<1.2.7"},{"fix":"Ensure you are using the correct command-line invocation: `pycrashreport <path/to/report.ips>`. Update any scripts or aliases to reflect the new name.","message":"The command-line script name was changed from a previous name (implicitly 'pycrash' or similar) to `pycrashreport` in version 1.2.1. Users relying on the CLI utility with older script names will experience 'command not found' errors.","severity":"breaking","affected_versions":"<1.2.1"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify that the file path for the crash report is correct and that the file exists at that location. Use an absolute path or ensure the script is run from the correct directory.","cause":"The path provided to the `CrashReport` constructor (or CLI) for the crash report file does not exist.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'non_existent_report.ips'"},{"fix":"Ensure the input is a genuine Apple crash report (e.g., an .ips file) and not corrupted. The library may only extract basic metadata for unsupported or severely malformed types. Review the content for standard Apple crash report headers and sections.","cause":"The input content provided to `CrashReport` is not a valid Apple crash report format, or it's severely malformed. PyCrashReport expects a specific structure for accurate parsing.","error":"Error parsing crash report: Crash report file is not valid"},{"fix":"Consult the PyCrashReport documentation or the object's `__dict__` for available attributes. Check the original crash report content; if the data isn't present in the report, the corresponding attribute might be `None` or not exist.","cause":"Attempting to access an attribute (e.g., `report.some_missing_attribute`) that does not exist in the parsed `CrashReport` object. This can happen if the crash report itself lacks that specific data, or if the attribute name is incorrect.","error":"AttributeError: 'CrashReport' object has no attribute 'some_missing_attribute'"}]}