75
75
mach_error_t AMDeviceLookupApplications (AMDeviceRef device, CFDictionaryRef options, CFDictionaryRef *result);
76
76
int AMDeviceGetInterfaceType (struct am_device *device);
77
77
78
- bool found_device = false , debug = false , verbose = false , unbuffered = false , nostart = false , detect_only = false , install = true , uninstall = false , no_wifi = false ;
78
+ bool found_device = false , debug = false , verbose = false , unbuffered = false , nostart = false , debugserver_only = false , detect_only = false , install = true , uninstall = false , no_wifi = false ;
79
79
bool command_only = false ;
80
80
char *command = NULL ;
81
81
char const *target_filename = NULL ;
@@ -921,7 +921,8 @@ void setup_lldb(AMDeviceRef device, CFURLRef url) {
921
921
922
922
mount_developer_image (device); // put debugserver on the device
923
923
start_remote_debug_server (device); // start debugserver
924
- write_lldb_prep_cmds (device, url); // dump the necessary lldb commands into a file
924
+ if (!debugserver_only)
925
+ write_lldb_prep_cmds (device, url); // dump the necessary lldb commands into a file
925
926
926
927
CFRelease (url);
927
928
@@ -1022,6 +1023,20 @@ void launch_debugger_and_exit(AMDeviceRef device, CFURLRef url) {
1022
1023
}
1023
1024
}
1024
1025
1026
+ void launch_debugserver_only (AMDeviceRef device, CFURLRef url)
1027
+ {
1028
+ CFRetain (url);
1029
+ setup_lldb (device,url);
1030
+
1031
+ CFStringRef bundle_identifier = copy_disk_app_identifier (url);
1032
+ CFURLRef device_app_url = copy_device_app_url (device, bundle_identifier);
1033
+ CFStringRef device_app_path = CFURLCopyFileSystemPath (device_app_url, kCFURLPOSIXPathStyle );
1034
+ CFRelease (url);
1035
+
1036
+ NSLogOut (@" debugserver port: %d " , port);
1037
+ NSLogOut (@" App path: %@ " , device_app_path);
1038
+ }
1039
+
1025
1040
CFStringRef get_bundle_id (CFURLRef app_url)
1026
1041
{
1027
1042
if (app_url == NULL )
@@ -1631,10 +1646,13 @@ void handle_device(AMDeviceRef device) {
1631
1646
if (!debug)
1632
1647
exit (0 ); // no debug phase
1633
1648
1634
- if (justlaunch)
1649
+ if (justlaunch) {
1635
1650
launch_debugger_and_exit (device, url);
1636
- else
1651
+ } else if (debugserver_only) {
1652
+ launch_debugserver_only (device, url);
1653
+ } else {
1637
1654
launch_debugger (device, url);
1655
+ }
1638
1656
}
1639
1657
1640
1658
void device_callback (struct am_device_notification_callback_info *info, void *arg) {
@@ -1716,6 +1734,7 @@ void usage(const char* app) {
1716
1734
@" -t, --timeout <timeout> number of seconds to wait for a device to be connected\n "
1717
1735
@" -u, --unbuffered don't buffer stdout\n "
1718
1736
@" -n, --nostart do not start the app when debugging\n "
1737
+ @" -N, --nolldb start debugserver only. do not run lldb\n "
1719
1738
@" -I, --noninteractive start in non interactive mode (quit when app crashes or exits)\n "
1720
1739
@" -L, --justlaunch just launch the app and exit lldb\n "
1721
1740
@" -v, --verbose enable verbose output\n "
@@ -1761,6 +1780,7 @@ int main(int argc, char *argv[]) {
1761
1780
{ " timeout" , required_argument, NULL , ' t' },
1762
1781
{ " unbuffered" , no_argument, NULL , ' u' },
1763
1782
{ " nostart" , no_argument, NULL , ' n' },
1783
+ { " nolldb" , no_argument, NULL , ' N' },
1764
1784
{ " noninteractive" , no_argument, NULL , ' I' },
1765
1785
{ " justlaunch" , no_argument, NULL , ' L' },
1766
1786
{ " detect" , no_argument, NULL , ' c' },
@@ -1784,7 +1804,7 @@ int main(int argc, char *argv[]) {
1784
1804
};
1785
1805
int ch;
1786
1806
1787
- while ((ch = getopt_long (argc, argv, " VmcdvunrILeD :R:i:b:a:t:g:x:p:1:2:o:l::w::9::B::W" , longopts, NULL )) != -1 )
1807
+ while ((ch = getopt_long (argc, argv, " VmcdvunNrILeD :R:i:b:a:t:g:x:p:1:2:o:l::w::9::B::W" , longopts, NULL )) != -1 )
1788
1808
{
1789
1809
switch (ch) {
1790
1810
case ' m' :
@@ -1815,6 +1835,10 @@ int main(int argc, char *argv[]) {
1815
1835
case ' n' :
1816
1836
nostart = true ;
1817
1837
break ;
1838
+ case ' N' :
1839
+ debugserver_only = true ;
1840
+ debug = true ;
1841
+ break ;
1818
1842
case ' I' :
1819
1843
interactive = false ;
1820
1844
debug = true ;
0 commit comments