Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ad7c97d01f | ||
![]() |
fa88a73a9a | ||
![]() |
83150622c2 | ||
![]() |
42f41798a6 | ||
![]() |
486d0d92e0 | ||
![]() |
c97735aaee | ||
![]() |
d7c38e9e9f | ||
![]() |
6f78fbc5f3 |
8
Makefile
8
Makefile
@@ -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
|
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
|
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
|
codesign -f -s "iPhone Developer" --entitlements Entitlements.plist demo.app
|
||||||
|
|
||||||
demo: demo.c
|
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-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:
|
symlink:
|
||||||
cd $(DEVICE_SUPPORT); ln -sfn "`find . -type d -maxdepth 1 -exec basename {} \; | tail -1`" Latest
|
cd $(DEVICE_SUPPORT); ln -sfn "`find . -type d -maxdepth 1 -exec basename {} \; | tail -1`" Latest
|
||||||
@@ -30,4 +30,4 @@ debug: all
|
|||||||
./ios-deploy --debug --bundle demo.app
|
./ios-deploy --debug --bundle demo.app
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.app demo ios-deploy
|
rm -rf *.app demo ios-deploy
|
||||||
|
28
README.md
28
README.md
@@ -10,20 +10,20 @@ Install and debug iPhone apps without using Xcode. Designed to work on unjailbro
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
./ios-deploy [OPTION]...
|
./ios-deploy [OPTION]...
|
||||||
-d, --debug launch the app in GDB after installation
|
-d, --debug launch the app in GDB after installation
|
||||||
-i, --id <device_id> the id of the device to connect to
|
-i, --id <device_id> the id of the device to connect to
|
||||||
-c, --detect only detect if the device is connected
|
-c, --detect only detect if the device is connected
|
||||||
-b, --bundle <bundle.app> the path to the app bundle to be installed
|
-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
|
-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
|
-t, --timeout <timeout> number of seconds to wait for a device to be connected
|
||||||
-u, --unbuffered don't buffer stdout
|
-u, --unbuffered don't buffer stdout
|
||||||
-g, --gdbargs <args> extra arguments to pass to GDB when starting the debugger
|
-g, --gdbargs <args> extra arguments to pass to GDB when starting the debugger
|
||||||
-x, --gdbexec <file> GDB commands script file
|
-x, --gdbexec <file> GDB commands script file
|
||||||
-n, --nostart do not start the app when debugging
|
-n, --nostart do not start the app when debugging
|
||||||
-v, --verbose enable verbose output
|
-v, --verbose enable verbose output
|
||||||
-m, --noinstall directly start debugging without app install (-d not required)
|
-m, --noinstall directly start debugging without app install (-d not required)
|
||||||
-V, --version print the executable version
|
-V, --version print the executable version
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
|
55
ios-deploy.c
55
ios-deploy.c
@@ -1,6 +1,7 @@
|
|||||||
//TODO: don't copy/mount DeveloperDiskImage.dmg if it's already done - Xcode checks this somehow
|
//TODO: don't copy/mount DeveloperDiskImage.dmg if it's already done - Xcode checks this somehow
|
||||||
|
|
||||||
#import <CoreFoundation/CoreFoundation.h>
|
#import <CoreFoundation/CoreFoundation.h>
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -15,9 +16,9 @@
|
|||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include "MobileDevice.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 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.
|
* Startup script passed to lldb.
|
||||||
@@ -26,7 +27,7 @@
|
|||||||
* log enable -v -f /Users/vargaz/gdb-remote.log gdb-remote all
|
* log enable -v -f /Users/vargaz/gdb-remote.log gdb-remote all
|
||||||
*/
|
*/
|
||||||
#define LLDB_PREP_CMDS CFSTR("\
|
#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\
|
target create \"{disk_app}\"\n\
|
||||||
script fruitstrap_device_app=\"{device_app}\"\n\
|
script fruitstrap_device_app=\"{device_app}\"\n\
|
||||||
script fruitstrap_connect_url=\"connect://127.0.0.1:12345\"\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 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 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 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;
|
bool found_device = false, debug = false, verbose = false, unbuffered = false, nostart = false, detect_only = false, install = true;
|
||||||
char *app_path = NULL;
|
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) {
|
CFURLRef copy_device_app_url(AMDeviceRef device, CFStringRef identifier) {
|
||||||
CFDictionaryRef result;
|
CFDictionaryRef result = nil;
|
||||||
assert(AMDeviceLookupApplications(device, 0, &result) == 0);
|
|
||||||
|
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);
|
CFDictionaryRef app_dict = CFDictionaryGetValue(result, identifier);
|
||||||
assert(app_dict != NULL);
|
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) {
|
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);
|
CFMutableStringRef cmds = CFStringCreateMutableCopy(NULL, 0, LLDB_PREP_CMDS);
|
||||||
CFRange range = { 0, CFStringGetLength(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);
|
CFStringFindAndReplace(cmds, CFSTR("{ds_path}"), ds_path, range, 0);
|
||||||
range.length = CFStringGetLength(cmds);
|
range.length = CFStringGetLength(cmds);
|
||||||
|
|
||||||
@@ -627,7 +663,10 @@ void launch_debugger(AMDeviceRef device, CFURLRef url) {
|
|||||||
parent = getpid();
|
parent = getpid();
|
||||||
int pid = fork();
|
int pid = fork();
|
||||||
if (pid == 0) {
|
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)
|
if(device_id != NULL)
|
||||||
strcat(lldb_shell, device_id);
|
strcat(lldb_shell, device_id);
|
||||||
system(lldb_shell); // launch lldb
|
system(lldb_shell); // launch lldb
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ios-deploy",
|
"name": "ios-deploy",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "launch iOS apps iOS devices from the command line (Xcode 4)",
|
"description": "launch iOS apps iOS devices from the command line (Xcode 4)",
|
||||||
"main": "ios-deploy",
|
"main": "ios-deploy",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Reference in New Issue
Block a user