74
74
mach_error_t AMDeviceLookupApplications (AMDeviceRef device, CFDictionaryRef options, CFDictionaryRef *result);
75
75
int AMDeviceGetInterfaceType (struct am_device *device);
76
76
77
- bool found_device = false , debug = false , verbose = false , unbuffered = false , nostart = false , detect_only = false , install = true , uninstall = false , no_wifi = false ;
77
+ 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 ;
78
78
bool command_only = false ;
79
79
char *command = NULL ;
80
80
char const *target_filename = NULL ;
@@ -932,7 +932,8 @@ void setup_lldb(AMDeviceRef device, CFURLRef url) {
932
932
933
933
mount_developer_image (device); // put debugserver on the device
934
934
start_remote_debug_server (device); // start debugserver
935
- write_lldb_prep_cmds (device, url); // dump the necessary lldb commands into a file
935
+ if (!debugserver_only)
936
+ write_lldb_prep_cmds (device, url); // dump the necessary lldb commands into a file
936
937
937
938
CFRelease (url);
938
939
@@ -1033,6 +1034,20 @@ void launch_debugger_and_exit(AMDeviceRef device, CFURLRef url) {
1033
1034
}
1034
1035
}
1035
1036
1037
+ void launch_debugserver_only (AMDeviceRef device, CFURLRef url)
1038
+ {
1039
+ CFRetain (url);
1040
+ setup_lldb (device,url);
1041
+
1042
+ CFStringRef bundle_identifier = copy_disk_app_identifier (url);
1043
+ CFURLRef device_app_url = copy_device_app_url (device, bundle_identifier);
1044
+ CFStringRef device_app_path = CFURLCopyFileSystemPath (device_app_url, kCFURLPOSIXPathStyle );
1045
+ CFRelease (url);
1046
+
1047
+ NSLogOut (@" debugserver port: %d " , port);
1048
+ NSLogOut (@" App path: %@ " , device_app_path);
1049
+ }
1050
+
1036
1051
CFStringRef get_bundle_id (CFURLRef app_url)
1037
1052
{
1038
1053
if (app_url == NULL )
@@ -1642,10 +1657,13 @@ void handle_device(AMDeviceRef device) {
1642
1657
if (!debug)
1643
1658
exit (0 ); // no debug phase
1644
1659
1645
- if (justlaunch)
1660
+ if (justlaunch) {
1646
1661
launch_debugger_and_exit (device, url);
1647
- else
1662
+ } else if (debugserver_only) {
1663
+ launch_debugserver_only (device, url);
1664
+ } else {
1648
1665
launch_debugger (device, url);
1666
+ }
1649
1667
}
1650
1668
1651
1669
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 "
@@ -1760,6 +1779,7 @@ int main(int argc, char *argv[]) {
1760
1779
{ " timeout" , required_argument, NULL , ' t' },
1761
1780
{ " unbuffered" , no_argument, NULL , ' u' },
1762
1781
{ " nostart" , no_argument, NULL , ' n' },
1782
+ { " nolldb" , no_argument, NULL , ' N' },
1763
1783
{ " noninteractive" , no_argument, NULL , ' I' },
1764
1784
{ " justlaunch" , no_argument, NULL , ' L' },
1765
1785
{ " detect" , no_argument, NULL , ' c' },
@@ -1782,7 +1802,7 @@ int main(int argc, char *argv[]) {
1782
1802
};
1783
1803
char ch;
1784
1804
1785
- 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 )
1805
+ 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 )
1786
1806
{
1787
1807
switch (ch) {
1788
1808
case ' m' :
@@ -1813,6 +1833,10 @@ int main(int argc, char *argv[]) {
1813
1833
case ' n' :
1814
1834
nostart = 1 ;
1815
1835
break ;
1836
+ case ' N' :
1837
+ debugserver_only = true ;
1838
+ debug = true ;
1839
+ break ;
1816
1840
case ' I' :
1817
1841
interactive = false ;
1818
1842
debug = 1 ;
0 commit comments