8 Commits

Author SHA1 Message Date
Shazron Abdullah
ad7c97d01f Updated version to 1.0.5 2014-03-20 17:03:52 -07:00
Shazron Abdullah
fa88a73a9a Fixes #20 - lldb startup super-slow unless ios-deploy.c is edited to match exact xcode version 2014-03-20 17:00:32 -07:00
Shazron Abdullah
83150622c2 Merge pull request #13 from zgramana/master
Fixes phonegap/ios-deploy#8.
2013-12-13 16:34:43 -08:00
Zachary Gramana
42f41798a6 Fixes phonegap/ios-deploy#8. 2013-12-13 16:02:14 -08:00
Shazron Abdullah
486d0d92e0 Merge pull request #12 from zgramana/master
Enabled LLDB interactive session. Perf improvement.
2013-12-12 13:39:43 -08:00
Zachary Gramana
c97735aaee Added back support for -n/--nostart option. 2013-12-10 11:18:13 -08:00
Zachary Gramana
d7c38e9e9f Enabled LLDB interactive session. Perf improvement. 2013-12-09 17:59:19 -08:00
Shazron Abdullah
6f78fbc5f3 Update README.md 2013-10-25 15:43:59 -07:00
4 changed files with 66 additions and 27 deletions

View File

@@ -1,4 +1,4 @@
IOS_CC = gcc
IOS_CC = gcc -ObjC
IOS_SDK = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk
DEVICE_SUPPORT = $(shell xcode-select --print-path)/Platforms/iPhoneOS.platform/DeviceSupport
@@ -11,10 +11,10 @@ demo.app: demo Info.plist
codesign -f -s "iPhone Developer" --entitlements Entitlements.plist demo.app
demo: demo.c
$(IOS_CC) -arch armv7 -isysroot $(IOS_SDK) -framework CoreFoundation -o demo demo.c
$(IOS_CC) -g -arch armv7 -isysroot $(IOS_SDK) -framework CoreFoundation -o demo demo.c
ios-deploy: clean ios-deploy.c
$(IOS_CC) -o ios-deploy -framework CoreFoundation -framework MobileDevice -F/System/Library/PrivateFrameworks ios-deploy.c
$(IOS_CC) -g -o ios-deploy -framework Foundation -framework CoreFoundation -framework MobileDevice -F/System/Library/PrivateFrameworks ios-deploy.c
symlink:
cd $(DEVICE_SUPPORT); ln -sfn "`find . -type d -maxdepth 1 -exec basename {} \; | tail -1`" Latest

View File

@@ -10,20 +10,20 @@ Install and debug iPhone apps without using Xcode. Designed to work on unjailbro
## Usage
./ios-deploy [OPTION]...
-d, --debug launch the app in GDB after installation
-i, --id <device_id> the id of the device to connect to
-c, --detect only detect if the device is connected
-b, --bundle <bundle.app> the path to the app bundle to be installed
-a, --args <args> command line arguments to pass to the app when launching it
-t, --timeout <timeout> number of seconds to wait for a device to be connected
-u, --unbuffered don't buffer stdout
-g, --gdbargs <args> extra arguments to pass to GDB when starting the debugger
-x, --gdbexec <file> GDB commands script file
-n, --nostart do not start the app when debugging
-v, --verbose enable verbose output
-m, --noinstall directly start debugging without app install (-d not required)
-V, --version print the executable version
./ios-deploy [OPTION]...
-d, --debug launch the app in GDB after installation
-i, --id <device_id> the id of the device to connect to
-c, --detect only detect if the device is connected
-b, --bundle <bundle.app> the path to the app bundle to be installed
-a, --args <args> command line arguments to pass to the app when launching it
-t, --timeout <timeout> number of seconds to wait for a device to be connected
-u, --unbuffered don't buffer stdout
-g, --gdbargs <args> extra arguments to pass to GDB when starting the debugger
-x, --gdbexec <file> GDB commands script file
-n, --nostart do not start the app when debugging
-v, --verbose enable verbose output
-m, --noinstall directly start debugging without app install (-d not required)
-V, --version print the executable version
## Demo

View File

@@ -1,6 +1,7 @@
//TODO: don't copy/mount DeveloperDiskImage.dmg if it's already done - Xcode checks this somehow
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
@@ -15,9 +16,9 @@
#include <netinet/tcp.h>
#include "MobileDevice.h"
#define APP_VERSION "1.0.4"
#define APP_VERSION "1.0.5"
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
#define LLDB_SHELL "python -u -c \"import time; time.sleep(0.5); print 'run'; time.sleep(2000000)\" | lldb -s " PREP_CMDS_PATH
#define LLDB_SHELL "python -u -c $'import time\ntime.sleep(1.0)\n%swhile True: time.sleep(0.1); cmd = raw_input(); print (cmd)' | lldb -s " PREP_CMDS_PATH
/*
* Startup script passed to lldb.
@@ -26,7 +27,7 @@
* log enable -v -f /Users/vargaz/gdb-remote.log gdb-remote all
*/
#define LLDB_PREP_CMDS CFSTR("\
platform select remote-ios --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/*\n\
platform select remote-ios --sysroot {symbols_path}\n\
target create \"{disk_app}\"\n\
script fruitstrap_device_app=\"{device_app}\"\n\
script fruitstrap_connect_url=\"connect://127.0.0.1:12345\"\n\
@@ -62,7 +63,7 @@ typedef struct am_device * AMDeviceRef;
int AMDeviceSecureTransferPath(int zero, AMDeviceRef device, CFURLRef url, CFDictionaryRef options, void *callback, int cbarg);
int AMDeviceSecureInstallApplication(int zero, AMDeviceRef device, CFURLRef url, CFDictionaryRef options, void *callback, int cbarg);
int AMDeviceMountImage(AMDeviceRef device, CFStringRef image, CFDictionaryRef options, void *callback, int cbarg);
int AMDeviceLookupApplications(AMDeviceRef device, int zero, CFDictionaryRef* result);
mach_error_t AMDeviceLookupApplications(AMDeviceRef device, CFDictionaryRef options, CFDictionaryRef *result);
bool found_device = false, debug = false, verbose = false, unbuffered = false, nostart = false, detect_only = false, install = true;
char *app_path = NULL;
@@ -346,8 +347,38 @@ mach_error_t install_callback(CFDictionaryRef dict, int arg) {
}
CFURLRef copy_device_app_url(AMDeviceRef device, CFStringRef identifier) {
CFDictionaryRef result;
assert(AMDeviceLookupApplications(device, 0, &result) == 0);
CFDictionaryRef result = nil;
NSArray *a = [NSArray arrayWithObjects:
@"CFBundleIdentifier", // absolute must
@"ApplicationDSID",
@"ApplicationType",
@"CFBundleExecutable",
@"CFBundleDisplayName",
@"CFBundleIconFile",
@"CFBundleName",
@"CFBundleShortVersionString",
@"CFBundleSupportedPlatforms",
@"CFBundleURLTypes",
@"CodeInfoIdentifier",
@"Container",
@"Entitlements",
@"HasSettingsBundle",
@"IsUpgradeable",
@"MinimumOSVersion",
@"Path",
@"SignerIdentity",
@"UIDeviceFamily",
@"UIFileSharingEnabled",
@"UIStatusBarHidden",
@"UISupportedInterfaceOrientations",
nil];
NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"];
CFDictionaryRef options = (CFDictionaryRef)optionsDict;
afc_error_t resultStatus = AMDeviceLookupApplications(device, options, &result);
assert(resultStatus == 0);
CFDictionaryRef app_dict = CFDictionaryGetValue(result, identifier);
assert(app_dict != NULL);
@@ -376,10 +407,15 @@ CFStringRef copy_disk_app_identifier(CFURLRef disk_app_url) {
}
void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
CFStringRef ds_path = copy_device_support_path(device);
CFStringRef symbols_path = CFStringCreateWithFormat(NULL, NULL, CFSTR("'%@/Symbols'"), ds_path);
CFMutableStringRef cmds = CFStringCreateMutableCopy(NULL, 0, LLDB_PREP_CMDS);
CFRange range = { 0, CFStringGetLength(cmds) };
CFStringRef ds_path = copy_device_support_path(device);
CFStringFindAndReplace(cmds, CFSTR("{symbols_path}"), symbols_path, range, 0);
range.length = CFStringGetLength(cmds);
CFStringFindAndReplace(cmds, CFSTR("{ds_path}"), ds_path, range, 0);
range.length = CFStringGetLength(cmds);
@@ -627,7 +663,10 @@ void launch_debugger(AMDeviceRef device, CFURLRef url) {
parent = getpid();
int pid = fork();
if (pid == 0) {
char lldb_shell[300] = LLDB_SHELL;
char *runOption = nostart ? "" : "print \\\'run\\\'\n";
char lldb_shell[400];
sprintf(lldb_shell, LLDB_SHELL, runOption);
if(device_id != NULL)
strcat(lldb_shell, device_id);
system(lldb_shell); // launch lldb

View File

@@ -1,6 +1,6 @@
{
"name": "ios-deploy",
"version": "1.0.4",
"version": "1.0.5",
"description": "launch iOS apps iOS devices from the command line (Xcode 4)",
"main": "ios-deploy",
"scripts": {