Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set a symbolic breakpoint on _WebThreadLockFromAnyThread in Xcode?

I'm using Xcode 4.3.2 with lldb as my debugger.

I have inherited a project that contains code that is calling UIKit from secondary threads, as shown by these log messages:

2012-05-02 21:48:14.603 Appname Dev[77594:16e0f] void _WebThreadLockFromAnyThread(bool), 0x8d5f810: Obtaining the web lock from a thread other than the main thread or the web thread. UIKit should not be called from a secondary thread.

I have cleaned up most of the code that was making UIKit calls from secondary threads, but I am still occasionally seeing this message in the logs. The app is not crashing, so it's difficult to pinpoint where the problem lies.

I'd like to set a breakpoint on _WebThreadLockFromAnyThread, but when I try to set a symbolic breakpoint using:

b _WebThreadLockFromAnyThread

the debugger tells me:

breakpoint set --name '_WebThreadLockFromAnyThread' Breakpoint created: 12: name = '_WebThreadLockFromAnyThread', locations = 0 (pending) WARNING: Unable to resolve breakpoint to any actual locations.

I've also tried creating the symbolic breakpoint using the UI in the breakpoint navigator, but I'm not sure what to enter for the module. When I leave the module blank, the breakpoint is created but it's still not breaking when the log message appears in the debug console.

Can anyone tell me how I can go about adding a breakpoint on _WebThreadLockFromAnyThread, and also how I would determine what the defining module is for this symbol?

like image 797
Greg Avatar asked May 03 '12 04:05

Greg


People also ask

How do I add a symbolic breakpoint in Xcode?

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.

What is a symbolic breakpoint?

Symbolic Breakpoints can be useful when debugging calls to native functions or when trying to set breakpoints inside multiple functions with the same name. They will pause JavaScript execution whenever a function with the given name is about to be invoked.

How do I debug my code in Xcode?

To set up your breakpoint, you simply need to open a project in Xcode or Android Studio, and click close to the code line number. That's how it looks in Xcode. You'll see a blue arrow appear, indicating that the execution will pause when it reaches that point.

What are breakpoints in Xcode?

What are breakpoints in Xcode? A breakpoint can be placed at a certain line of code and pauses your app during execution in order to inspect the state of your app at that point. Breakpoints can be set at any time, before and while your app is running.


1 Answers

Just leave out the underscore. b WebThreadLockFromAnyThread works for me in both lldb and gdb. Now, this is Xcode 4.6, so if you're stuck on the older version I suppose it's possible that there's an issue in that version not present in 4.6.

like image 94
Aaron Golden Avatar answered Sep 21 '22 13:09

Aaron Golden