Bottom-line question: Is it possible to have Xcode wait for an application to launch, then launch the application from outside of Xcode, then have Xcode stop at a breakpoint?
--detailed description below--
I would like to debug (step through line-by-line) a simple C program that requires text to be piped in to stdin using Xcode 4.6.3 on 10.8.5.
In order to do-so I need to launch the program like this
$ cat in.txt | ./mysimpleprogram > out.txt
and have the Xcode debugger stop at a breakpoint.
I followed the instructions that I found in this answer https://stackoverflow.com/a/13006633/2779792 but Xcode does not stop at the breakpoints.
To reproduce the issue
Open Xcode 4.6.3
In the "Welcome to Xcode" screen choose "Create a new Xcode project"
In the "Choose a template for your new project" screen choose Mac OS X -> Application -> Command Line Tool then click Next
In the "Choose options for your new project:" screen Product Name: HelloWorld, Type: C -> Next, Use Automatic Reference Counting = False
Choose a location for the project.
Note: In Xcode preferences -> Locations -> Derived data, I have selected "Relative"
Go to Product menu -> Scheme -> Edit Scheme
On the left side of the Scheme Editing window, selected by default is "Run HelloWorld Debug". On the right side of the Scheme Editing window I changed the Launch Automatically radio button to "Wait for HelloWorld to launch". Debugger = LLDB, Debug Process As = me
Set one or more breakpoints in the code.
Select Product -> Run (or click the Play button). Now the main Xcode window says "Waiting for HelloWorld to launch".
Open a terminal window and navigate to the HelloWorld executable, in my case .../HelloWorld/DerivedData/HelloWorld/Build/Products/Debug/
run the program with the command ./HelloWord
The program runs and prints Hello, World! as expected, Xcode says "Finished running HelloWorld : HelloWorld". It did not stop at any of the breakpoints.
Desired behavior, Xcode should stop at the breakpoints and allow me to step through the code.
Thank you for any help or hints.