IOS crash log exception types

I have seen several different types of crash logs since I started learning iOS development.

I know that: Type of exception: EXC_BAD_ACCESS (SIGSEGV) means that we are referring to the released object.

but do not know about:
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Type: EXC_CRASH (SIGABRT)
Exception Type: EXC_BREAKPOINT (SIGTRAP)

Do you know how many exception types are in iOS crash logs and what do they mean?

+46
ios objective-c exception iphone crash-reports
Sep 16 '11 at 15:02
source share
3 answers

I know that: Type of exception: EXC_BAD_ACCESS (SIGSEGV) means that we are referring to the released object.

No.

A SIGSEGV is a segmentation error, that is, you are trying to access an invalid memory address.

These exceptions (in fact, they are signals) are not related to Objective-C, but C. Thus, you can get such an exception without Objective-C objects.

Please note that the signal is no exception, that is, you cannot catch them with the @try and @catch .

You can install a signal handler with the signal and sigaction . Note that some signals, such as SIGABRT, cannot be blocked.

You can check the Wikipedia page for alerts if you need more information.

However, to renew:

SIGSEGV (segmentation error)

Access to an invalid memory address. An address exists, but your program does not have access to it.

SIGBUS (bus error)

Access to an invalid memory address. Address does not exist or alignment is invalid.

SIGFPE (floating point exception)

Invalid arithmetic operation. May be associated with entire operations, despite the name.

Sigpipe

Broken pipe.

Sigill

Invalid processor instruction.

SIGTRAP

Debugger linked

SIGABRT

A program crash unrelated to one of the previous signals.

+89
Sep 16 2018-11-11T00:
source share

SIGSEGV literally means that you are accessing an address that you do not have. Therefore, it is not necessary that you access the released object; you can access an object that never existed, as in:

 UIView *view; // uninitialised, could point to anything [view setFrame:someFrame]; 

Or even just make a mistake in non-object materials of level C, for example:

 int array[100]; array[1000] = 23; // out-of-bounds access 

SIGBUS is very similar to SIGSEGV, the difference is on the hardware level (usually the difference between trying to access an address that exists but which you don’t have and trying to access an address that has nothing behind it, but this is not a strict definition), but usually associated with the same errors, although SIGBUS is much more likely to be associated with an uninitialized variable than SIGSEGV.

If you are trying to correlate the errors you probably made in Objective-C, you probably just want to read SIGSEGV and SIGBUS together, which means "access to memory, which I had no right to do."

SIGABRT is a program trying to interrupt itself, so this usually means that some internal consistency check failed. For example, SIGABRT occurs if you try to free the same memory twice, or - at the Cocoa level, if you raise a NSException that has not been caught. If you get SIGABRT, you did something wrong that is detected by the system software (as opposed to SEGV and BUS, which occur in the hardware).

SIGTRAP is a call from the program to the debugger. Anecdotally, Apple seems to use them when you are doing something wrong that might be detected in the software, but relates to the environment, not your specific code. So, for example, you call the C function, which exists in the SDK that you created, but not on the device you are working on (for example, when you create against the last SDK with a lower deployment target) or perform similar work with the object.

+27
Sep 16 2018-11-11T00:
source share

These messages are taken from gdb and they are not exclusive to objective-C. To get information about signals, all you have to do is enter info signals on the debugger console, this is an example output . Sorry to not post it here, but the console output format is terrible.

Source and additional signal information

+4
Sep 16 '11 at 15:33
source share



All Articles