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.
If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.
Navigate to a line in your code where you want execution to pause, then click the gutter or line number in the source editor to set a breakpoint. Xcode displays a breakpoint icon to indicate the location. Drag a breakpoint up or down to move it to another location; drag it away from the gutter to remove it.
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With