How to determine the OSX process which is presenting a dialog?

Today when restarting a MacBook Air I got a pop-up stating "The managed object model version used to open the persistent store is incompatible with the one that was used to create the persistent store."

OSX Error Dialog

However there is nothing indicating which app or process triggered this. Clicking on the dialog doesn't switch application. Is there a way to find out what is producing this message (while it is still open)? I tried searching for the log message in /Library/Logs ~/Library/Logs and /var/log but found nothing.


Solution 1:

I was able to track this down using Accessibility Inspector.app (which I think is bundled with XCode). See the answer to How to identify a process from a toolbar icon.