If you are using the Xcode debugger (which uses gdb under the hood), pause the application and in the console enter:
b _NSLockError
The debugger will then stop the application when _NSLockError occurs, and you can check the backtrace.
a source
to share