Search code examples
iosios8xcode6breakpointsdispatch-async

Xcode breakpoint don't work inside dispatch_async block


Our team seriously need some help with the following problem that we are facing as it is preventing us from debugging some of the code inside dispatch_async block.

Hope I will get some help or suggestions on what to do next.

The problem we faced is as below:

We recently hit a strange problem where in Xcode 6, we are not able to break within the dispatch_async block.

- (void)viewDidLoad {

        dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);    

        dispatch_async(queue, ^{


        BOOL setRtn = TRUE;  //<- break point is set here but never break

        //call to function
        BOOL setFn = some_function();
        });

} 



- (BOOL) some_function()
{
     BOOL test = YES;   <- break point set here, breakpoint break!


     return test;
}

What happens is that when we set a breakpoint within any line in the dispatch_async block, the code never breaks and the break point never works.

However, if we set the breakpoint within the function that is called by the dispatch_async block, the breakpoint works!

Is anyone else facing the same problem?

We are using Xcode 6.1 and is working on IOS8.1

Please help, have been going crazy trying to solve this problem for days.


Solution

  • It turns out that it was because of a 3rd party framework New Relic. After removing reference to the New Relic framework, we can then step inside the dispatch_async block.

    So for any developer working on project that has a new relic plugin, you can temporary remove reference to the plugin and add it back later when your debugging id complete.

    It took us a few days to find out , and we hope that this piece of information is helpful to everyone.