Skip to content

Commit fccb595

Browse files
LinusUshazron
authored andcommitted
Add back to code for --nolldb (-N) (#331)
1 parent 3b8ae5f commit fccb595

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/ios-deploy/ios-deploy.m

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
mach_error_t AMDeviceLookupApplications(AMDeviceRef device, CFDictionaryRef options, CFDictionaryRef *result);
7676
int AMDeviceGetInterfaceType(struct am_device *device);
7777

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;
7979
bool command_only = false;
8080
char *command = NULL;
8181
char const*target_filename = NULL;
@@ -921,7 +921,8 @@ void setup_lldb(AMDeviceRef device, CFURLRef url) {
921921

922922
mount_developer_image(device); // put debugserver on the device
923923
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
925926

926927
CFRelease(url);
927928

@@ -1022,6 +1023,20 @@ void launch_debugger_and_exit(AMDeviceRef device, CFURLRef url) {
10221023
}
10231024
}
10241025

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+
10251040
CFStringRef get_bundle_id(CFURLRef app_url)
10261041
{
10271042
if (app_url == NULL)
@@ -1631,10 +1646,13 @@ void handle_device(AMDeviceRef device) {
16311646
if (!debug)
16321647
exit(0); // no debug phase
16331648

1634-
if (justlaunch)
1649+
if (justlaunch) {
16351650
launch_debugger_and_exit(device, url);
1636-
else
1651+
} else if (debugserver_only) {
1652+
launch_debugserver_only(device, url);
1653+
} else {
16371654
launch_debugger(device, url);
1655+
}
16381656
}
16391657

16401658
void device_callback(struct am_device_notification_callback_info *info, void *arg) {
@@ -1716,6 +1734,7 @@ void usage(const char* app) {
17161734
@" -t, --timeout <timeout> number of seconds to wait for a device to be connected\n"
17171735
@" -u, --unbuffered don't buffer stdout\n"
17181736
@" -n, --nostart do not start the app when debugging\n"
1737+
@" -N, --nolldb start debugserver only. do not run lldb\n"
17191738
@" -I, --noninteractive start in non interactive mode (quit when app crashes or exits)\n"
17201739
@" -L, --justlaunch just launch the app and exit lldb\n"
17211740
@" -v, --verbose enable verbose output\n"
@@ -1761,6 +1780,7 @@ int main(int argc, char *argv[]) {
17611780
{ "timeout", required_argument, NULL, 't' },
17621781
{ "unbuffered", no_argument, NULL, 'u' },
17631782
{ "nostart", no_argument, NULL, 'n' },
1783+
{ "nolldb", no_argument, NULL, 'N' },
17641784
{ "noninteractive", no_argument, NULL, 'I' },
17651785
{ "justlaunch", no_argument, NULL, 'L' },
17661786
{ "detect", no_argument, NULL, 'c' },
@@ -1784,7 +1804,7 @@ int main(int argc, char *argv[]) {
17841804
};
17851805
int ch;
17861806

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)
17881808
{
17891809
switch (ch) {
17901810
case 'm':
@@ -1815,6 +1835,10 @@ int main(int argc, char *argv[]) {
18151835
case 'n':
18161836
nostart = true;
18171837
break;
1838+
case 'N':
1839+
debugserver_only = true;
1840+
debug = true;
1841+
break;
18181842
case 'I':
18191843
interactive = false;
18201844
debug = true;

0 commit comments

Comments
 (0)