2

I am trying to debug multiple threads.

 *** -[NSLock lock]: deadlock (<NSLock: 0xc388ab0> '(null)')
 *** Break on _NSLockError() to debug.

How can I debug this?

Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556

1 Answers1

5

If you're using the Xcode debugger (which uses gdb under the hood), pause the app and in the console enter:

b _NSLockError

Then the debugger will stop the app when _NSLockError happens, which you should be able to check the backtrace.

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
  • 3
    +1 You can also open the breakpoints window (`cmd-opt-b`) and add it there. – Dave DeLong Apr 28 '10 at 18:33
  • Alternatively use the XCode 4 GUI to set the breakpoint. Instructions are posted at [link](http://stackoverflow.com/questions/1299785/break-on-nslockerror-to-debug-how-to) – Opsimath Mar 10 '12 at 02:27