diff options
author | Jan Peter Stotz | 2020-10-22 12:03:56 +0200 |
---|---|---|
committer | Nikias Bassen | 2020-12-10 00:38:33 +0100 |
commit | fad6a83086d39d4f6ee6cab8276238a71cd165ff (patch) | |
tree | 0278e398a60f32a04d6618239f33aef37e91a6d3 | |
parent | f856a65a23be48bdda0a0ec2a0ef0b687402afce (diff) | |
download | libimobiledevice-fad6a83086d39d4f6ee6cab8276238a71cd165ff.tar.gz libimobiledevice-fad6a83086d39d4f6ee6cab8276238a71cd165ff.tar.bz2 |
idevicedebug: Add --detach option to start an app and exit idevicedebug without killing the app
-rw-r--r-- | tools/idevicedebug.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c index 83a70a4..74ce069 100644 --- a/tools/idevicedebug.c +++ b/tools/idevicedebug.c @@ -197,6 +197,7 @@ static void print_usage(int argc, char **argv) printf("The following OPTIONS are accepted:\n"); printf(" -u, --udid UDID\ttarget specific device by UDID\n"); printf(" -n, --network\t\tconnect to network device\n"); + printf(" --detach\t\tdetach from app after launch, keeping it running\n"); printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n"); printf(" -d, --debug\t\tenable communication debugging\n"); printf(" -h, --help\t\tprints usage information\n"); @@ -217,6 +218,7 @@ int main(int argc, char *argv[]) int cmd = CMD_NONE; const char* udid = NULL; int use_network = 0; + int detach_after_start = 0; const char* bundle_identifier = NULL; char* path = NULL; char* working_directory = NULL; @@ -254,6 +256,9 @@ int main(int argc, char *argv[]) } else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { use_network = 1; continue; + } else if (!strcmp(argv[i], "--detach")) { + detach_after_start = 1; + continue; } else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--env")) { i++; if (!argv[i] || (strlen(argv[i]) <= 1) || strchr(argv[i], '=') == NULL) { @@ -447,6 +452,17 @@ int main(int argc, char *argv[]) response = NULL; } + if (detach_after_start) { + log_debug("Detaching from app"); + debugserver_command_new("D", 0, NULL, &command); + dres = debugserver_client_send_command(debugserver_client, command, &response, NULL); + debugserver_command_free(command); + command = NULL; + + res = (dres == DEBUGSERVER_E_SUCCESS) ? 0: -1; + break; + } + /* set thread */ log_debug("Setting thread..."); debugserver_command_new("Hc0", 0, NULL, &command); |