Merge pull request #12 from zgramana/master
Enabled LLDB interactive session. Perf improvement.
This commit is contained in:
commit
486d0d92e0
6
Makefile
6
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
|
||||||
|
44
ios-deploy.c
44
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>
|
||||||
@ -17,7 +18,7 @@
|
|||||||
|
|
||||||
#define APP_VERSION "1.0.4"
|
#define APP_VERSION "1.0.4"
|
||||||
#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.
|
||||||
@ -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);
|
||||||
@ -627,7 +658,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
|
||||||
|
Loading…
Reference in New Issue
Block a user