Where is EXC_BAD_ACCESS documented?

One of the most common debugging errors in my own development (Mac, iOS) is EXC_BAD_ACCESS. Despite its prevalence, its origin and exact meaning remain mysterious. Google lists a lot of mistakes, but the only explanation I could find is unofficial and incomplete.

I know that this exception (if this is the correct term for it) means that the code tried to access an address to which it does not have read and / or write permissions - a zero address, for example, or an address outside the process address space. But this is an intuitive interpretation based on my previous experience with virtual memory and protected memory systems. I have never seen the EXC_BAD_ACCESS documentation anywhere, and I'm really not sure who sends this exception to me - processor, Mac OS, UNIX, runtime, debugger? - so I don’t know with whom to ask (what is, what class of documentation to consult). I would like to know, for example, what β€œcode” means, which is indicated with an exception. Or another example: what other classes of similar exceptions (supposedly also marked as "EXC_") can also come from the same source?

Where can I find an explanation of EXC_BAD_ACCESS, its codes and general semantics, from an authoritative source? What is the authoritative source - who actually detects and throws an exception?

+1
source share
1 answer

The only official documentation I could find for EXC_BAD_ACCESS is Technical Q & A, called the Error Finder EXC_BAD_ACCESS in the Cocoa Project . It is dated and confirms only what you already know:

This problem is usually the result of an excessive release of the object. This can be very confusing, since failure tends to occur well after an error. A crash can also occur when the program is deep in the code of the framework, often without your own code visible on the stack.

Indeed, this can be very confusing. At least Apple recognizes that. :)

+2
source

Source: https://habr.com/ru/post/978155/


All Articles