|
32 | 32 | target create \"{disk_app}\"\n\
|
33 | 33 | script fruitstrap_device_app=\"{device_app}\"\n\
|
34 | 34 | script fruitstrap_connect_url=\"connect://127.0.0.1:{device_port}\"\n\
|
| 35 | + script fruitstrap_output_path=\"{output_path}\"\n\ |
| 36 | + script fruitstrap_error_path=\"{error_path}\"\n\ |
35 | 37 | target modules search-paths add {modules_search_paths_pairs}\n\
|
36 | 38 | command script import \"{python_file_path}\"\n\
|
37 | 39 | command script add -f {python_command}.connect_command connect\n\
|
|
66 | 68 | #include "lldb.py.h"
|
67 | 69 | ;
|
68 | 70 |
|
| 71 | +const char* output_path = NULL; |
| 72 | +const char* error_path = NULL; |
69 | 73 |
|
70 | 74 | typedef struct am_device * AMDeviceRef;
|
71 | 75 | mach_error_t AMDeviceSecureStartService(AMDeviceRef device, CFStringRef service_name, unsigned int *unknown, ServiceConnRef * handle);
|
@@ -730,6 +734,21 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
|
730 | 734 | CFStringFindAndReplace(cmds, CFSTR("{device_port}"), device_port, range, 0);
|
731 | 735 | range.length = CFStringGetLength(cmds);
|
732 | 736 |
|
| 737 | + if (output_path) { |
| 738 | + CFStringRef output_path_str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s"), output_path); |
| 739 | + CFStringFindAndReplace(cmds, CFSTR("{output_path}"), output_path_str, range, 0); |
| 740 | + } else { |
| 741 | + CFStringFindAndReplace(cmds, CFSTR("{output_path}"), CFSTR(""), range, 0); |
| 742 | + } |
| 743 | + range.length = CFStringGetLength(cmds); |
| 744 | + if (error_path) { |
| 745 | + CFStringRef error_path_str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%s"), error_path); |
| 746 | + CFStringFindAndReplace(cmds, CFSTR("{error_path}"), error_path_str, range, 0); |
| 747 | + } else { |
| 748 | + CFStringFindAndReplace(cmds, CFSTR("{error_path}"), CFSTR(""), range, 0); |
| 749 | + } |
| 750 | + range.length = CFStringGetLength(cmds); |
| 751 | + |
733 | 752 | CFURLRef device_container_url = CFURLCreateCopyDeletingLastPathComponent(NULL, device_app_url);
|
734 | 753 | CFStringRef device_container_path = CFURLCopyFileSystemPath(device_container_url, kCFURLPOSIXPathStyle);
|
735 | 754 | CFMutableStringRef dcp_noprivate = CFStringCreateMutableCopy(NULL, 0, device_container_path);
|
@@ -1777,6 +1796,8 @@ void usage(const char* app) {
|
1777 | 1796 | @" -e, --exists check if the app with given bundle_id is installed or not \n"
|
1778 | 1797 | @" -B, --list_bundle_id list bundle_id \n"
|
1779 | 1798 | @" -W, --no-wifi ignore wifi devices\n"
|
| 1799 | + @" -O, --output <file> write stdout to this file\n" |
| 1800 | + @" -E, --error_output <file> write stderr to this file\n" |
1780 | 1801 | @" --detect_deadlocks <sec> start printing backtraces for all threads periodically after specific amount of seconds\n"
|
1781 | 1802 | @" -j, --json format output as JSON\n",
|
1782 | 1803 | [NSString stringWithUTF8String:app]);
|
@@ -1825,13 +1846,15 @@ int main(int argc, char *argv[]) {
|
1825 | 1846 | { "exists", no_argument, NULL, 'e'},
|
1826 | 1847 | { "list_bundle_id", no_argument, NULL, 'B'},
|
1827 | 1848 | { "no-wifi", no_argument, NULL, 'W'},
|
| 1849 | + { "output", required_argument, NULL, 'O' }, |
| 1850 | + { "error_output", required_argument, NULL, 'E' }, |
1828 | 1851 | { "detect_deadlocks", required_argument, NULL, 1000 },
|
1829 | 1852 | { "json", no_argument, NULL, 'j'},
|
1830 | 1853 | { NULL, 0, NULL, 0 },
|
1831 | 1854 | };
|
1832 | 1855 | int ch;
|
1833 | 1856 |
|
1834 |
| - while ((ch = getopt_long(argc, argv, "VmcdvunrILeD:R:i:b:a:t:p:1:2:o:l:w:9BWjNs:", longopts, NULL)) != -1) |
| 1857 | + while ((ch = getopt_long(argc, argv, "VmcdvunrILeD:R:i:b:a:t:p:1:2:o:l:w:9BWjNs:OE:", longopts, NULL)) != -1) |
1835 | 1858 | {
|
1836 | 1859 | switch (ch) {
|
1837 | 1860 | case 'm':
|
@@ -1937,6 +1960,12 @@ int main(int argc, char *argv[]) {
|
1937 | 1960 | case 'W':
|
1938 | 1961 | no_wifi = true;
|
1939 | 1962 | break;
|
| 1963 | + case 'O': |
| 1964 | + output_path = optarg; |
| 1965 | + break; |
| 1966 | + case 'E': |
| 1967 | + error_path = optarg; |
| 1968 | + break; |
1940 | 1969 | case 1000:
|
1941 | 1970 | _detectDeadlockTimeout = atoi(optarg);
|
1942 | 1971 | break;
|
|
0 commit comments