From fc1aa27ca22fbc8180f18ce33c179377d85d0964 Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Tue, 5 Mar 2013 14:56:28 +0100 Subject: [PATCH] add 'no_start' option to 'rake device debug=1' to let people attach their own debugger (rubymine) --- bin/deploy.m | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/bin/deploy.m b/bin/deploy.m index b350ce8c..4cfc0378 100644 --- a/bin/deploy.m +++ b/bin/deploy.m @@ -435,15 +435,7 @@ start_debugger(am_device_t dev) CFDataRef address_data = CFDataCreate(NULL, (const UInt8 *)&address, sizeof(address)); - unlink(gdb_unix_socket_path); - - CFSocketSetAddress(fdvendor, address_data); - CFRelease(address_data); - CFRunLoopAddSource(CFRunLoopGetMain(), - CFSocketCreateRunLoopSource(NULL, fdvendor, 0), - kCFRunLoopCommonModes); - - // Prepare gdb commands file. + // Locate app path on device. NSDictionary *info_plist = [NSDictionary dictionaryWithContentsOfFile: [app_path stringByAppendingPathComponent:@"Info.plist"]]; @@ -458,6 +450,24 @@ start_debugger(am_device_t dev) assert(app != nil); NSString *app_remote_path = [app objectForKey:@"Path"]; + // If we need to attach an external debugger, we can quit here. + + if (getenv("no_start")) { + printf("%s\n%s\n", [app_remote_path fileSystemRepresentation], + gdb_unix_socket_path); + return; + } + + unlink(gdb_unix_socket_path); + + CFSocketSetAddress(fdvendor, address_data); + CFRelease(address_data); + CFRunLoopAddSource(CFRunLoopGetMain(), + CFSocketCreateRunLoopSource(NULL, fdvendor, 0), + kCFRunLoopCommonModes); + + // Prepare gdb commands file. + NSString *cmds_path = [NSString pathWithComponents: [NSArray arrayWithObjects:NSTemporaryDirectory(), @"_deploygdbcmds", nil]];