views:

1088

answers:

2

Hi folks

During debugging the console always spits me an error message: "Break on _NSLockError() to debug"

My assumption is: in XCode i have to appear a certain breackpoint, so that the debugger stops at the point where this error occurs.

How can i make this?

+1  A: 

1/ From the menu choose Build -> Build and Debug

2/ Click the "GDB" icon - you will be switched to the "Debugger console"

3/ Press Control+C to interrupt your binary. You will get the gdb prompt.

4/ type in "b _NSLockError" and continue execution after setting the breakpoint.

(gdb) b _NSLockError
Breakpoint 8 at 0x911db1a9
(gdb) c
Continuing.

5/ you can interact with GDB just as it was running from console, i.e. you can Ctrl+C again and view current breakpoints:

(gdb) info breakpo
Num Type           Disp Enb Address    What
8   breakpoint     keep y   0x911db1a9 <_NSLockError+9>
diciu
Thanks!!!That's exactly what I was looking for :)
Nobik
I sometimes find it easier to debug my binaries from Terminal.app by running them from within GDB, i.e. "gdb /path_to/App.app/Contents/MacOS/App"
diciu
Hmm... it's much easier to do it my way, since it will continue to apply across debug sessions...
sbwoodside
+1  A: 

To do this automatically for your project in XCode:

  1. In Xcode, Option-Command-B to open the Breakpoints window (or Run>Show>Breakpoints).
  2. Where it says "Double-Click for Symbol", double click... and paste in "_NSLockError".
  3. Click anywhere else in the window, and your new entry will automatically be updated with Location = "Foundation"
  4. Build & Go and you will now drop into the debugger automatically when you hit an automatically-detected deadlock.
sbwoodside