Aug 22, 2018 Click Subscribe For More Videos!! CLICK THAT THUMBS UP BUTTON!! Follow Dre Beas(Giant Productions) On Instagram @RatedGPMedia Follow Rylo Rodriguez on Instagram @RyloRodriguez. App Center supports crash reporting in macOS extensions. The usage is the same as in the container application. Generate a test crash. App Center Crashes provides you with an API to generate a test crash for easy testing of the SDK. This API can only be used in test/beta apps and won't do anything in production apps. MSCrashes generateTestCrash. When an application crashes, you typically see a dialog box informing you that it has âunexpectedly quit. The good news is that these crashes.
Technical Note TN2151
Welcome to the crash course on how to use Mac Operating System (commonly referred to as Mac OS or Macos ). If you have recently switched from Windows to Mac OS X on an Apple Macbook or iMac, the differences between the two operating systems might seem confusing, frustrating and even a bit overwhelming at first. Assuming you then use sudo to be root, the Mac will crash. The biggest risk from command line is data loss. The macOS interface is designed over decades to not surprise people and shred their data or settings or apps. The macOS graphical interface also exists to remove the learning curve (a steep one) to being safe and mastering shell scripting.
When an application crashes, a crash report is created which is very useful for understanding what caused the crash. This document contains essential information about how to symbolicate, understand, and interpret crash reports.
Symbolicating Crash Reports
Analyzing Crash Reports
Introduction
When an application crashes, a crash report is created and stored on the device. Crash reports describe the conditions under which the application terminated, in most cases including a complete backtrace for each executing thread, and are typically very useful for debugging issues in the application. You should look at these crash reports to understand what crashes your application is having, and then try to fix them.
Crash reports with backtraces need to be symbolicated before they can be analyzed. Symbolication replaces memory addresses with human-readable function names and line numbers. If you get crash logs off a device through Xcode's Devices window, then they will be symbolicated for you automatically after a few seconds. Otherwise you will need to symbolicate the
.crash file yourself by importing it to the Xcode Devices window. See Symbolicating Crash Reports for details.
A Low Memory report differs from other crash reports in that there are no backtraces in this type of report. When a low memory crash happens, you must investigate your memory usage patterns and your responses to low memory warnings. This document points to you several memory management references that you might find useful.
Acquiring Crash and Low Memory Reports
Debugging Deployed iOS Apps discusses how to retrieve crash and low memory reports directly from an iOS device.
Analyzing Crash Reports in the App Distribution Guide discusses how to view aggregate crash reports collected from TestFlight beta testers and users who have downloaded your app from the App Store.
Symbolicating Crash Reports
Symbolication is the process of resolving backtrace addresses to source code method or function names, known as symbols. Without first symbolicating a crash report it is difficult to determine where the crash occurred.
Note: Draftsight for mac os x 10.5 8. Low Memory Reports do not need to be symbolicated.
Note: Crash reports from macOS are typically symbolicated, or partially symbolicated, at the time they are generated. This section focuses on symbolicating crash reports from iOS, watchOS, and tvOS, but the overall process is similar for macOS.
Bitcode
Bitcode is an intermediate representation of a compiled program. When you archive an application with bitcode enabled, the compiler produces binaries containing bitcode rather than machine code. Once the binary has been uploaded to the App Store, the bitcode is compiled down to machine code. The App Store may compile the bitcode again in the future, to take advantage of future compiler improvements without any action on your part.
Because the final compilation of your binary occurs on the App Store, your Mac will not contain the debug symbol (
dSYM ) files needed to symbolicate crash reports received from App Review or from users who have sent you crash reports from their devices. Although a dSYM file is produced when you archive your application, it is for the bitcode binary and can not be used to symbolicate crash reports. The App Store makes the dSYM files generated during bitcode compilation available for you to download, from Xcode or from the iTunes Connect website. You must download these dSYM files in order to symbolicate crash reports received from App Review or from users who have sent you crash reports from their devices. Crash reports received through the crash reporting service will be symbolicated automatically.
Important: The binary compiled by the App Store will have different UUIDs than the binary that was originally submitted.
Downloading the dSYM files from Xcode
Xcode downloads the
dSYM files and inserts them into the selected archive.
Downloading the dSYM files from the iTunes Connect website
Translating 'hidden' symbol names back to their original names
When you upload your app with bitcode to the App Store, you may choose not to send your application's symbols by unchecking the 'Upload your app's symbols to receive symbolicated reports from Apple' box in the submission dialog. If you choose not to send your app's symbol information to Apple, Xcode will replace the symbols in your app's .
dSYM files with obfuscated symbols such as '__hidden#109_' before sending your app to iTunes Connect. Xcode creates a mapping between the original symbols and the 'hidden' symbols and stores this mapping in a .bcsymbolmap file inside the application archive. Each .dSYM file will have a corresponding .bcsymbolmap file.
Before symbolicating crash reports, you will need to de-obfuscate the symbols in the .
dSYM files downloaded from iTunes Connect. If you use the Download dSYMs button in Xcode, this de-obfuscation will be performed automatically for you. However, if you use the iTunes Connect website to download the .dSYM files, open Terminal and use the following command to de-obfuscate your symbols (replacing the example paths with your own archive and the dSYMs folder downloaded from iTunes Connect):
Run this command for each .
dSYM file inside the dSYMs folder you downloaded.
Determining Whether a Crash Report is Symbolicated
A crash report may be unsymbolicated, fully symbolicated, or partially symbolicated. Unsymbolicated crash reports will not contain the method or function names in the backtrace. Instead, you have hexadecimal addresses of executable code within the loaded binary images. In a fully symbolicated crash report, the hexadecimal addresses in every line of the backtrace are replaced with the corresponding symbol. In a partially symbolicated crash report, only some of the addresses in the backtrace have been replaced with their corresponding symbols.
Obviously, you should try to fully symbolicate any crash report you receive as it will provide the most insight about the crash. A partially symbolicated crash report may contain enough information to understand the crash, depending upon the type of crash and which parts of the backtraces were successfully symbolicated. An unsymbolicated crash report is rarely useful.
Symbolicating iOS Crash Reports With Xcode
Xcode will automatically attempt to symbolicate all crash reports that it encounters. All you need to do for symbolication is to add the crash report to the Xcode Organizer.
Note: Xcode will not accept crash reports without a
.crash extension. If you have received a crash report without an extension, or with a .txt extension, rename it to have a .crash extension before following the steps listed below.
To symbolicate a crash report, Xcode needs to be able to locate the following:
If any of these are missing Xcode may not be able to symbolicate the crash report, or may only partially symbolicate the crash report.
Symbolicating Crash Reports With atos
The atos command converts numeric addresses to their symbolic equivalents. If full debug symbol information is available then the output of
atos will include file name and source line number information. The atos command can be used to symbolicate individual addresses in the backtrace of an unsymbolicated, or partially symbolicated, crash report. To symbolicate a part of a crash report using atos :
Listing 1 Example usage of the
atos command following the steps above, and the resulting output.
Symbolication Troubleshooting
If Xcode is failing to fully symbolicate a crash report, it's likely because your Mac is missing the
dSYM file for the application binary, the dSYM files for one or more frameworks the application links against, or the device symbols for the OS the application was running on when it crashed. The steps below show how to use Spotlight to determine whether the dSYM file needed to symbolicate a backtrace addresse within a binary image is present on your Mac.
If Spotlight found a
dSYM file for the binary but Xcode was not able to symbolicate addresses within that binary image, then you should file a bug. Attach the crash report and the relevant dSYM file(s) to the bug report. As a workaround, you can manually symbolicate the address using atos . See Symbolicating Crash Reports With atos.
If Spotlight did not find a
dSYM for the binary image, verify that you still have the Xcode archive for the version of your application that crashed and that this archive is located somewhere that Spotlight can find it (any location in your home directory should do). If your application was built with bitcode enabled, make sure you have downloaded the dSYM files for the final compilation from the App Store. See Downloading the dSYM files from Xcode.
If you think that you have the correct
dSYM for the binary image, you can use the dwarfdump command to print the matching UUIDs. You can also use the dwarfdump command to print the UUIDs of a binary.
xcrun dwarfdump --uuid <Path to dSYM file>
Note: You must have the archive that you originally submitted to the App Store for the version of your application that is crashing. The
dSYM file and application binary are specifically tied together on a per-build-basis. Creating a new archive, even from the same sources and build configuration, will not produce a dSYM file that can interoperate with the crashing build.
If you no longer have this archive, you should submit a new version of your application for which you retain the archive. You will then be able to symbolicate crash reports for this new version.
Analyzing Crash Reports
This section discusses each of the sections found within a standard crash report.
Header
Every crash report begins with a header.
Listing 4 Excerpt of the header from a crash report.
Most of the fields are self-explanatory but a few deserve special note:
Exception Information
Not to be confused with Objective-C/C++ exceptions (though one of those may be the cause of the crash), this section lists the Mach Exception Type and related fields which provide information about the nature of the crash. Not all fields will be present in every crash report.
Listing 5 Excerpt of the Exception Codes section from a crash report generated when a process was terminated due to an uncaught Objective-C exception.
Listing 6 Excerpt of the Exception Codes section from a crash report generated when a process was terminated because it dereferenced a NULL pointer.
An explanation of the fields that may appear in this section are presented below.
The following sections explain some of the most common exception types:
Bad Memory Access [EXC_BAD_ACCESS // SIGSEGV // SIGBUS]
The process attempted to access invalid memory, or it attempted to access memory in a manner not allowed by the memory's protection level (e.g. writing to read-only memory). The Exception Subtype field contains a
kern_return_t describing error and the address of the memory that was incorrectly accessed.
Here are some tips for debugging a bad memory access crash:
Abnormal Exit [EXC_CRASH // SIGABRT]
The process exited abnormally. The most common causes of crashes with this exception type are uncaught Objective-C/C++ exceptions and calls to
abort() .
App Extensions will be terminated with this exception type if they take too much time to initialize (a watchdog termination). If an extension is killed due to a hang at launch, the Exception Subtype of the generated crash report will be
LAUNCH_HANG . Because extensions do not have a main function, any time spent initializing occurs within static constructors and +load methods present in your extension and dependent libraries. You should defer as much of this work as possible.
Trace Trap [EXC_BREAKPOINT // SIGTRAP]
Similar to an Abnormal Exit, this exception is intended to give an attached debugger the chance to interrupt the process at a specific point in its execution. You can trigger this exception from your own code using the
__builtin_trap() function. If no debugger is attached, the process is terminated and a crash report is generated.
Lower-level libraries (e.g. libdispatch) will trap the process upon encountering a fatal error. Additional information about the error can be found in the Additional Diagnostic Information section of the crash report, or in the device's console.
Swift code will terminate with this exception type if an unexpected condition is encountered at runtime such as:
Look at the Backtraces to determine where the unexpected condition was encountered. Additional information may have also been logged to the device's console. You should modify the code at the crashing location to gracefully handle the runtime failure. For example, use Optional Binding instead of force unwrapping an optional.
Illegal Instruction [EXC_BAD_INSTRUCTION // SIGILL]
The process attempted to execute an illegal or undefined instruction. The process may have attempted to jump to an invalid address via a misconfigured function pointer.
On Intel processors, the
ud2 opcode causes an EXC_BAD_INSTRUCTION exception but is commonly used to trap the process for debugging purposes. Swift code on Intel processors will terminate with this exception type if an unexpected condition is encountered at runtime. See Trace Trap for details.
Quit [SIGQUIT]
The process was terminated at the request of another process with privileges to manage its lifetime.
SIGQUIT does not mean that the process crashed, but it did likely misbehave in a detectable manner.
On iOS, keyboard extensions will be quit by the host app if they take too long to load. It's unlikely that the Backtraces shown in the crash report will point to the responsible code. Most likely, some other code along the startup path for the extension has taken a long time to complete but finished before the time limit, and execution moved onto the code shown in the Backtraces when the extension was quit. You should profile the extension to better understand where most of the work during startup is occurring, and move that work to a background thread or defer it until later (after the extension has loaded).
Killed [SIGKILL]
The process was terminated at the request of the system. Look at the Termination Reason field to better understand the cause of the termination.
The Termination Reason field will contain a namespace followed by a code. The following codes are specific to watchOS:
Guarded Resource Violation [EXC_GUARD]
The process violated a guarded resource protection. Duo for mac. System libraries may mark certain file descriptors as guarded, after which normal operations on those descriptors will trigger an
EXC_GUARD exception (when it wants to operate on these file descriptors, the system uses special 'guarded' private APIs). This helps you quickly track down issues such as closing a file descriptor that had been opened by a system library. For example, if an app closes the file descriptor used to access the SQLite file backing a Core Data store, Core Data would then crash mysteriously much later on. The guard exception gets these problems noticed sooner, and thus makes them easier to debug.
Crash reports from newer versions of iOS include human-readable details about the operation that caused the
EXC_GUARD exception in the Exception Subtype and Exception Message fields. In crash reports from macOS or older versions of iOS, this information is encoded into the first Exception Code as a bitfield which breaks down as follows:
Resource Limit [EXC_RESOURCE]
The process exceeded a resource consumption limit. This is a notification from the OS that the process is using too many resources. The exact resource is listed in the Exception Subtype field. If the Exception Note field contains
NON-FATAL CONDITION , then the process was not killed even though a crash report was generated.
Other Exception Types
Some crash reports may contain an un-named Exception Type, which will be printed as a hexadecimal value (e.g. 00000020). If you receive one of these crash reports, look directly to the Exception Codes field for more information.
Note: Terminating a suspended app using the app switcher does not generate a crash report. Once an app has suspended, it is eligible for termination by iOS at any time, so no crash report will be generated.
Additional Diagnostic Information
This section includes additional diagnostic information specific to the type of termination, which may include:
Starting in macOS Sierra, iOS 10, watchOS 3, and tvOS 10, most of this information is now reported in the Termination Reason field under the Exception Information.
You should read this section to better understand the circumstances under which the process was terminated.
Listing 7 Excerpt of the Application Specific Information section from a crash report generated when a process was terminated because a framework it links against could not be found.
Listing 8 Excerpt of the Application Specific Information section from a crash report generated when a process was terminated because it failed to load its initial view controller quickly.
Backtraces
The most interesting part of a crash report is the backtrace for each of the process's threads at the time it terminated. Each of these traces is similar to what you would see when pausing the process with the debugger.
Listing 9 Excerpt of the Backtrace section from a fully symbolicated crash report.
The first line lists the thread number and the identifier of the currently executing dispatch queue. The remaining lines list details about the individual stack frames in the backtrace. From left to right:
Exceptions
Exceptions in Objective-C are used to indicate programming errors detected at runtime such as accessing an array with an index that is out-of-bounds, attempts to mutate immutable objects, not implementing a required method of a protocol, or sending a message which the receiver does not recognize.
Note: Messaging a previously deallocated object may raise an
NSInvalidArgumentException instead of crashing the program with a memory access violation. This occurs when a new object is allocated in the memory previously occupied by the deallocated object. If your application is crashing due to an uncaught NSInvalidArgumentException (look for -[NSObject(NSObject) doesNotRecognizeSelector:] in the exception backtrace), consider profiling your application with the Zombies instrument to eliminate the possibility that improper memory management is the cause.
If an exception is not caught, it is intercepted by a function called the uncaught exception handler. The default uncaught exception handler logs the exception message to the device's console then terminates the process. Only the exception backtrace is written to the generated crash report under the Last Exception Backtrace section, as shown in Listing 10. The exception message is omitted from the crash report. If you receive a crash report with a Last Exception Backtrace you should acquire the console logs from the originating device to better understand the conditions which caused the exception.
Listing 10 Excerpt of the Last Exception Backtrace section from an unsymbolicated crash report.
A crash log with a Last Exception Backtrace containing only hexadecimal addresses must be symbolicated to produce a usable backtrace as shown in Listing 11.
Listing 11 Excerpt of the Last Exception Backtrace section from a symbolicated crash report. This exception was raised when loading a scene in the app's storyboard. The corresponding IBOutlet for a connection to an element in the scene was missing.
Note: If you find that exceptions thrown within an exception handling domain setup by your application are not being caught, verify that you are not specifying the
-no_compact_unwind flag when building your application or libraries.
64-bit iOS uses a 'zero-cost' exception implementation. In a 'zero-cost' system, every function has additional data that describes how to unwind the stack if an exception is thrown across the function. If an exception is thrown across a stack frame that has no unwind data then exception handling cannot proceed and the process halts. There might be an exception handler farther up the stack, but if there is no unwind data for a frame then there is no way to get there from the stack frame where the exception was thrown. Specifying the
-no_compact_unwind flag means you get no unwind tables for that code, so you can not throw exceptions across those functions.
Additionally, if you are including plain C code in your application or a library, you may need to specify the
-funwind-tables flag to include unwind tables for all functions in that code.
Thread State
This section lists the thread state of the crashed thread. This is a list of registers and their values at the time execution halted. Understanding the thread state is not necessary when reading a crash report but you may be able to use this information to better understand the conditions of the crash.
Listing 12 Excerpt of the Thread State section from a crash report from an ARM64 device.
Binary Images
This section lists the binary images that were loaded in the process at the time of termination.
Listing 13 Excerpt of the application's entry in the binary images section of a crash report.
Each line includes the following details for a single binary image:
Understanding Low Memory Reports
When a low-memory condition is detected, the virtual memory system in iOS relies on the cooperation of applications to release memory. Low-memory notifications are sent to all running applications and processes as a request to free up memory, hoping to reduce the amount of memory in use. If memory pressure still exists, the system may terminate background processes to ease memory pressure. If enough memory can be freed up, your application will continue to run. If not, your application will be terminated by iOS because there isn't enough memory to satisfy the application's demands, and a low memory report will be generated and stored on the device.
The format of a low memory report differs from other crash reports in that there are no backtraces for the application threads. A low memory report begins with a header similar to the Header of a crash report. Following the header are a collection of fields listing system-wide memory statistics. Take note of the value for the Page Size field. The memory usage of each process in a low memory report is reported in terms of number of memory pages.
The most important part of a low memory report is the table of processes. This table lists all running processes, including system daemons, at the time the low memory report was generated. If a process was 'jettisoned', the reason will be listed under the [reason] column. A process may be jettisoned for a number of reasons:
If you do not see a reason listed next to your app/extension process, the cause of the crash was not memory pressure. Look for a
.crash file (described in the previous section) for more information.
Rylo For Macos Crash Download
When you see a low memory crash, rather than be concerned about what part of your code was executing at the time of termination, you should investigate your memory usage patterns and your responses to low memory warnings. Locating Memory Issues in Your App lists detailed steps on how to use the Leaks Instrument to discover memory leaks, and how to use the Allocations Instrument's Mark Heap feature to avoid abandoned memory. Memory Usage Performance Guidelines discusses the proper ways to respond to low-memory notifications as well as many tips for using memory effectively. It is also recommended that you check out the WWDC 2010 session, Advanced Memory Analysis with Instruments.
Important: The Leaks and Allocations instruments do not track all memory usage. You need to run your application with the VM Tracker instrument (included in the Instruments Allocations template) to see your total memory usage. VM Tracker is disabled by default. To profile your application with VM Tracker, click the instrument, check the 'Automatic Snapshotting' flag or press the 'Snapshot Now' button manually.
Related Documents
For information about how to use the Instruments Zombies template to fix memory overrelease crashes, see Eradicating Zombies with the Zombies Trace Template.
For more information about application archiving, refer to the the App Distribution Guide.
For more information about interpreting crash logs, see Understanding Crash Reports on iPhone OS WWDC 2010 Session.
Document Revision History
Copyright © 2018 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2018-01-08
Enable or Disable crash reporting via launchtl.
ReportCrash analyzes crashing processes and saves a crash report to disk. A crash report contains information that can help a developer diagnose the cause of a crash. ReportCrash also records the identity of the crashing process and the location of the saved crash report in the system.log and the ASL log database.
ReportCrash is invoked automatically by launchd when a crash is detected. For applications and other processes running in the per-user launchd context, ReportCrash runs as a LaunchAgent and saves crash reports in the user's ~/Library/Logs/DiagnosticReports/ directory.
For daemons, other processes running in the system launchd context and other privileged processes, ReportCrash runs as a LaunchDaemon and saves crash reports in the system's /Library/Logs/DiagnosticReports directory where they are only readable by admin users. If there are too many crash reports saved for a particular process, older reports will automatically be removed in order to conserve disk space.
Rylo For Macos Crash Video
For application crashes (but not background process crashes) ReportCrash will display a dialog notifying the user that the application unexpectedly quit and offering to reopen the application or send the report to Apple. For developers, the behavior of this dialog can be adjusted using /Developer/Applications/Utilities/CrashReporterPrefs.app which is installed as part of the developer tools.
Crash reports which are sent to Apple are submitted anonymously by the SubmitDiagInfo process. The reports are used by Apple to improve its products.
âI hate modern car radios. In my car, I don't even have a push-button radio. It's just got a dial and two knobs. Just AM. One knob makes it louder, and one knob changes the station. When you're driving, that's all I want.â ~ Chris Isaak
Related macOS commands:
Feedback Assistant for developers - Report bugs.
TN2123 - interpreting the contents of crash reports.
Copyright © 1999-2020 SS64.com
Some rights reserved Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |