I'm trying to create an NSTask that uses GDB to attach to a program, but my program just freezes after launching the task. Is this possible to do? Here is the code I'm using:
NSTask *task = [NSTask new];
[task setLaunchPath:@"/usr/bin/gdb"];
NSArray *args = [NSArray arrayWithObjects:@"TestApp.app", nil];
[task setArguments:args];
[task launch];
NSLog(@"Launched.");
NSData *data = [[outPipe fileHandleForReading] readDataToEndOfFile];
NSLog(@"Read data.");
I'm certain "TestApp.app" is in the correct location because I don't get "No such file or directory" errors. The console only prints "Launched." and the spinning beachball just continues for over a minute until I kill the run. Any ideas what could make this work?