How can I use xcdebug?

I started a Mac app which I just built with Xcode. I quit it from Xcode and started it from the dock. Now I have the process ID but this command does not work.

xcdebug --pid 1234

Run xcdebug -h shows the help text but does not show the commands which are supported. There are no docs found on the developer site either.

Answered by Developer Tools Engineer in 708064022

the help text but does not show the commands which are supported

This is because you are supposed to pass the command or program that is the one you want to debug. The tool is mostly intended for command line programs, but works for GUI applications as well. For example, if you want to debug Calculator.app, just pass the full path to the Calculator binary as the command:

$ xcdebug /System/Applications/Calculator.app/Contents/MacOS/Calculator

This will start the Calculator app, and then start a debugging session of it in Xcode. If you want to run and debug your own app, use the path to your app's executable instead.

Note that the --pid argument is not for passing in a PID of a process to debug. It's a PID of an Xcode instance and this argument is only useful in situations when you have multiple Xcodes installed.

Accepted Answer

the help text but does not show the commands which are supported

This is because you are supposed to pass the command or program that is the one you want to debug. The tool is mostly intended for command line programs, but works for GUI applications as well. For example, if you want to debug Calculator.app, just pass the full path to the Calculator binary as the command:

$ xcdebug /System/Applications/Calculator.app/Contents/MacOS/Calculator

This will start the Calculator app, and then start a debugging session of it in Xcode. If you want to run and debug your own app, use the path to your app's executable instead.

Note that the --pid argument is not for passing in a PID of a process to debug. It's a PID of an Xcode instance and this argument is only useful in situations when you have multiple Xcodes installed.

How can I use xcdebug?
 
 
Q